Address comments
This commit is contained in:
parent
db2b10d2a4
commit
86124fc609
8 changed files with 30 additions and 40 deletions
|
|
@ -27,13 +27,13 @@ namespace LibationCli
|
|||
}
|
||||
*/
|
||||
#endregion
|
||||
[Option(shortName: 'x', longName: "xlsx", HelpText = "Microsoft Excel Spreadsheet", SetName = "Export Format")]
|
||||
[Option(shortName: 'x', longName: "xlsx", HelpText = "Microsoft Excel Spreadsheet", SetName = "xlsx")]
|
||||
public bool xlsx { get; set; }
|
||||
|
||||
[Option(shortName: 'c', longName: "csv", HelpText = "Comma-separated values", SetName = "Export Format")]
|
||||
[Option(shortName: 'c', longName: "csv", HelpText = "Comma-separated values", SetName = "csv")]
|
||||
public bool csv { get; set; }
|
||||
|
||||
[Option(shortName: 'j', longName: "json", HelpText = "JavaScript Object Notation", SetName = "Export Format")]
|
||||
[Option(shortName: 'j', longName: "json", HelpText = "JavaScript Object Notation", SetName = "json")]
|
||||
public bool json { get; set; }
|
||||
|
||||
protected override Task ProcessAsync()
|
||||
|
|
|
|||
|
|
@ -11,6 +11,9 @@ namespace LibationCli.Options;
|
|||
[Verb("search", HelpText = "Search for books in your library")]
|
||||
internal class SearchOptions : OptionsBase
|
||||
{
|
||||
[Option('n', Default = 10, HelpText = "Number of search results per page")]
|
||||
public int NumResultsPerPage { get; set; }
|
||||
|
||||
[Value(0, MetaName = "query", Required = true, HelpText = "Lucene search string")]
|
||||
public IEnumerable<string> Query { get; set; }
|
||||
|
||||
|
|
@ -21,15 +24,13 @@ internal class SearchOptions : OptionsBase
|
|||
|
||||
Console.WriteLine($"Found {results.Count} matching results.");
|
||||
|
||||
const int numResults = 10;
|
||||
|
||||
string nextPrompt = "Press any key for the next " + numResults + " results or Esc for all results";
|
||||
string nextPrompt = "Press any key for the next " + NumResultsPerPage + " results or Esc for all results";
|
||||
bool waitForNextBatch = true;
|
||||
|
||||
for (int i = 0; i < results.Count; i += numResults)
|
||||
for (int i = 0; i < results.Count; i += NumResultsPerPage)
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
for (int j = i; j < int.Min(results.Count, i + numResults); j++)
|
||||
for (int j = i; j < int.Min(results.Count, i + NumResultsPerPage); j++)
|
||||
sb.AppendLine(getDocDisplay(results[j].Doc));
|
||||
|
||||
Console.Write(sb.ToString());
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ namespace LibationCli
|
|||
""")]
|
||||
public class SetDownloadStatusOptions : OptionsBase
|
||||
{
|
||||
//https://github.com/commandlineparser/commandline/wiki/Option-Groups
|
||||
[Option(shortName: 'd', longName: "downloaded", Group = "Download Status", HelpText = "set download status to 'Downloaded'")]
|
||||
public bool SetDownloaded { get; set; }
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue