Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to get a value? #4

Open
gbl opened this issue Aug 24, 2018 · 0 comments
Open

Add option to get a value? #4

gbl opened this issue Aug 24, 2018 · 0 comments

Comments

@gbl
Copy link

gbl commented Aug 24, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant