Skip to content

Commit 2ec3b59

Browse files
committed
Added more help info about using write with an update script
1 parent 56c9232 commit 2ec3b59

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

yaml.go

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,25 @@ yaml r things.yaml a.array[*].blah
3333
var cmdWrite = &cobra.Command{
3434
Use: "write [yaml_file] [path] [value]",
3535
Aliases: []string{"w"},
36-
Short: "yaml w [--inplace/-i] sample.yaml a.b.c newValueForC",
36+
Short: "yaml w [--inplace/-i] [--script/-s script_file] sample.yaml a.b.c newValueForC",
3737
Example: `
3838
yaml write things.yaml a.b.c cat
3939
yaml write --inplace things.yaml a.b.c cat
4040
yaml w -i things.yaml a.b.c cat
41+
yaml w --script update_script.yaml things.yaml
42+
yaml w -i -s update_script.yaml things.yaml
4143
`,
4244
Long: `Updates the yaml file w.r.t the given path and value.
43-
Outputs to STDOUT unless the inplace flag is used, in which case the file is updated instead.`,
45+
Outputs to STDOUT unless the inplace flag is used, in which case the file is updated instead.
46+
47+
Update Scripts:
48+
Note that you can give an update script to perform more sophisticated updated. Update script
49+
format is a yaml map where the key is the path and the value is..well the value. e.g.:
50+
---
51+
a.b.c: true,
52+
a.b.e:
53+
- name: bob
54+
`,
4455
Run: writeProperty,
4556
}
4657
cmdWrite.PersistentFlags().BoolVarP(&writeInplace, "inplace", "i", false, "update the yaml file inplace")

0 commit comments

Comments
 (0)