This commit is contained in:
Mike Farah 2022-10-29 18:22:30 +11:00
parent d99614f55a
commit 6d6cd43255
3 changed files with 15 additions and 0 deletions

View File

@ -0,0 +1,5 @@
# Slice Array
The slice array operator takes an array as input and returns a subarray. Like the `jq` equivalent, `.[10:15]` will return an array of length 5, starting from index 10 inclusive, up to index 15 exclusive. Negative numbers count backwards from the end of the array.
You may leave out the first or second number, which will will refer to the start or end of the array respectively.

View File

@ -1,3 +1,8 @@
# Slice Array
The slice array operator takes an array as input and returns a subarray. Like the `jq` equivalent, `.[10:15]` will return an array of length 5, starting from index 10 inclusive, up to index 15 exclusive. Negative numbers count backwards from the end of the array.
You may leave out the first or second number, which will will refer to the start or end of the array respectively.
## Slicing arrays
Given a sample.yml file of:

View File

@ -1,7 +1,12 @@
4.29.1:
- Fixed Square brackets removing update #1342
- Added slice array operator (.[10:15]) #44
- XML decoder/encoder now parses directives and proc instructions (#1344). Please use the new skip flags [documented here](https://mikefarah.gitbook.io/yq/usage/xml) to ignore them.
- XML users note that the default attribute prefix will change to `+@` in the 4.30 release to avoid naming conflicts!
- Improved comment handling of decoders (breaking change for yqlib users sorry)
- Fixed load operator bug when loading yaml file with multiple documents
- Bumped Go compiler version
- Bumped dependencies
4.28.2:
- Fixed Github Actions issues (thanks @mattphelps-8451)