pandastrike / yaml-cli

A simple CLI for querying and updating YAML files
ISC License
86 stars 5 forks source link

auto create flag for set #7

Open dyoder opened 8 years ago

dyoder commented 8 years ago

Sometimes you want to set a nested attribute whose parent properties may not be set.

Ex:

foo:
  bar: hello
$ yaml set test.yaml foo.baz.nested goodbye

Right now, this returns an error. Which makes sense because foo.baz.nested isn't actually a property. But we could auto-create properties. I don't think this is a great default behavior, but we could add a flag for it to override the default.

$ yaml -set -- auto foo.baz.nested goodbye
foo:
  bar: hello
  baz:
    nested: goodbye