Add stdin support to --query parameter
This commit is contained in:
parent
e006e06685
commit
3b59dd7c0a
2 changed files with 6 additions and 1 deletions
|
@ -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}
|
||||
|
||||
|
|
|
@ -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…
Reference in a new issue