Skip to content

Add option to get a value? #4

@gbl

Description

@gbl

I'd really like to see an option that outputs a list of subkeys of a key, or the value of a (sub)key.

For a yaml file that looks like this:

`root:
    elem1:
        something: 'value`'
         otherthing: 'value'
    elem2:
        something: 'value'

I'd like to be able to call

yaml_cli -g root                                        <== outputs "elem1 elem2"
yaml_cli -g root:elem1                             <== outputs "something otherthing"
yaml_cli -g root.elem1.something           <== outputs "value"

That would allow me to write a shell script like

for i in $(yaml_cli -g root); do yaml_cli -s root:$i:something newval; done
to set all somethings to a value, regardless of which elements exist.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions