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

How to edit subkey of a list item #2

Open
egoldblum opened this issue Jun 21, 2018 · 0 comments
Open

How to edit subkey of a list item #2

egoldblum opened this issue Jun 21, 2018 · 0 comments

Comments

@egoldblum
Copy link

Given a file like

$ cat example.yaml
foo:
  - name: bar
  - name: baz
  - name: bat

I'd like to output

foo:
  - name: bar
  - name: quux
  - name: bat

Is there a way to index into a specific index in a list and a set a subkey while leaving all other subkeys and list item peers unchanged?

$ yaml_cli -i example.yaml -s foo:1:name quux
foo:
  '1':
    name: quux
$ yaml_cli -i example.yaml -s foo[1]:name quux
foo:
- name: bar
- name: baz
- name: bat
foo[1]:
  name: quux
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