Skip to content

Commit

Permalink
Added more help info about using write with an update script
Browse files Browse the repository at this point in the history
  • Loading branch information
mikefarah committed Oct 9, 2015
1 parent 56c9232 commit 2ec3b59
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions yaml.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,25 @@ yaml r things.yaml a.array[*].blah
var cmdWrite = &cobra.Command{
Use: "write [yaml_file] [path] [value]",
Aliases: []string{"w"},
Short: "yaml w [--inplace/-i] sample.yaml a.b.c newValueForC",
Short: "yaml w [--inplace/-i] [--script/-s script_file] sample.yaml a.b.c newValueForC",
Example: `
yaml write things.yaml a.b.c cat
yaml write --inplace things.yaml a.b.c cat
yaml w -i things.yaml a.b.c cat
yaml w --script update_script.yaml things.yaml
yaml w -i -s update_script.yaml things.yaml
`,
Long: `Updates the yaml file w.r.t the given path and value.
Outputs to STDOUT unless the inplace flag is used, in which case the file is updated instead.`,
Outputs to STDOUT unless the inplace flag is used, in which case the file is updated instead.
Update Scripts:
Note that you can give an update script to perform more sophisticated updated. Update script
format is a yaml map where the key is the path and the value is..well the value. e.g.:
---
a.b.c: true,
a.b.e:
- name: bob
`,
Run: writeProperty,
}
cmdWrite.PersistentFlags().BoolVarP(&writeInplace, "inplace", "i", false, "update the yaml file inplace")
Expand Down

0 comments on commit 2ec3b59

Please sign in to comment.