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

Feature: Add append to array #39

Merged

Conversation

kenjones-cisco
Copy link
Contributor

Adds the ability to append a value to an array instead of having to
know the index of the values within the array.

Resolves: #17

Adds the ability to append a value to an array instead of having to
know the index of the values within the array.

Resolves: mikefarah#17
@kenjones-cisco kenjones-cisco merged commit 9d1a5b1 into mikefarah:master Sep 24, 2017
@kenjones-cisco kenjones-cisco deleted the feature/append-array branch September 24, 2017 00:24
@Rambatino
Copy link

Is this in the docs? I no can find.

@mikefarah
Copy link
Owner

@Rambatino
Copy link

Thanks!

@Rambatino
Copy link

Can it support like passing a json object? The example is only one element, but I'd like to pass a nested structure to it.

@mikefarah
Copy link
Owner

Only one fields at a time:

yq n 'an.array[+].field.list[+].thing' apples
an:
  array:
  - field:
      list:
      - thing: apples

but you could use
http://mikefarah.github.io/yq/write/#updating-multiple-values-with-a-script
to add multiples

@Rambatino
Copy link

Thanks @mikefarah!

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

Successfully merging this pull request may close these issues.

3 participants