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

Read array length #283

Closed
elliotpryde opened this issue Oct 17, 2019 · 1 comment
Closed

Read array length #283

elliotpryde opened this issue Oct 17, 2019 · 1 comment

Comments

@elliotpryde
Copy link

I'd like to be able to parse the following

arr:
- name: first
  version: 1.0
- name: second
  version: 2.0

into a structure that preserves the relationships between array element properties.

For example the following snippet preserves the relationship via the array index, however, we can't loop through indexes unless we know the array length.

arr[0].name
arr[0].version

Having functionality similar to jq's length function would allow us to write more filtering logic based on what yq returns.

@mikefarah
Copy link
Owner

Fixed in https://github.com/mikefarah/yq/releases/tag/3.2.0
See https://mikefarah.gitbook.io/yq/commands/read#printing-length-of-the-results

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

No branches or pull requests

2 participants