Browse Source

Add stdin support to --query parameter

master
Starbeamrainbowlabs 3 years ago
parent
commit
3b59dd7c0a
Signed by: sbrl GPG Key ID: 1BE5172E637709C2
  1. 2
      SearchBox-CLI/EmbeddedFiles/Help.txt
  2. 5
      SearchBox-CLI/Program.cs

2
SearchBox-CLI/EmbeddedFiles/Help.txt

@ -22,7 +22,7 @@ Options:
--limit Limits the number of results returned, -1 = no limit {query}
--offset Skips the specified number of results from the beginning of results list {query}
--old-source Specifies the path to the old version of the source document update {update}
--query Specifies the query string {query, context}
--query Specifies the query string - set to "-" to use the first line of stdin instead {query, context}
--source, -s Specifies the path to the source document {index, add,context}
--tags Sets the tags to associate with the document. {add, update}

5
SearchBox-CLI/Program.cs

@ -222,6 +222,11 @@ namespace SearchBoxCLI
return 1;
}
// Use the first line of stdin instead of the actual query string if "-" is specified
if (Query == "-") {
Query = Console.ReadLine().Trim();
}
SearchBox searchBox = JsonConvert.DeserializeObject<SearchBox>(
File.ReadAllText(SearchIndexFilepath)
);

Loading…
Cancel
Save