Added command help about using stdin

This commit is contained in:
Mike Farah 2021-04-19 10:26:58 +10:00
parent b2a538bdfc
commit 2483c38eeb
2 changed files with 6 additions and 0 deletions

View File

@ -17,6 +17,9 @@ func createEvaluateAllCommand() *cobra.Command {
Example: ` Example: `
# merges f2.yml into f1.yml (inplace) # merges f2.yml into f1.yml (inplace)
yq eval-all --inplace 'select(fileIndex == 0) * select(fileIndex == 1)' f1.yml f2.yml yq eval-all --inplace 'select(fileIndex == 0) * select(fileIndex == 1)' f1.yml f2.yml
# use '-' as a filename to read from STDIN
cat file2.yml | yq ea '.a.b' file1.yml - file3.yml
`, `,
Long: "Evaluate All:\nUseful when you need to run an expression across several yaml documents or files. Consumes more memory than eval", Long: "Evaluate All:\nUseful when you need to run an expression across several yaml documents or files. Consumes more memory than eval",
RunE: evaluateAll, RunE: evaluateAll,

View File

@ -21,6 +21,9 @@ yq e '.a.b | length' f1.yml f2.yml
# prints out the file # prints out the file
yq e sample.yaml yq e sample.yaml
# use '-' as a filename to read from STDIN
cat file2.yml | yq e '.a.b' file1.yml - file3.yml
# prints a new yaml document # prints a new yaml document
yq e -n '.a.b.c = "cat"' yq e -n '.a.b.c = "cat"'