From 6d6cd43255ab85087ffc450a8aae73ce8e99e61d Mon Sep 17 00:00:00 2001 From: Mike Farah Date: Sat, 29 Oct 2022 18:22:30 +1100 Subject: [PATCH] docs --- pkg/yqlib/doc/operators/headers/slice-array.md | 5 +++++ pkg/yqlib/doc/operators/slice-array.md | 5 +++++ release_notes.txt | 5 +++++ 3 files changed, 15 insertions(+) create mode 100644 pkg/yqlib/doc/operators/headers/slice-array.md diff --git a/pkg/yqlib/doc/operators/headers/slice-array.md b/pkg/yqlib/doc/operators/headers/slice-array.md new file mode 100644 index 0000000000..5676fd93d8 --- /dev/null +++ b/pkg/yqlib/doc/operators/headers/slice-array.md @@ -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. diff --git a/pkg/yqlib/doc/operators/slice-array.md b/pkg/yqlib/doc/operators/slice-array.md index f0cdc26123..b9a6a844fb 100644 --- a/pkg/yqlib/doc/operators/slice-array.md +++ b/pkg/yqlib/doc/operators/slice-array.md @@ -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: diff --git a/release_notes.txt b/release_notes.txt index 158343e39d..2ad2b3c685 100644 --- a/release_notes.txt +++ b/release_notes.txt @@ -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)