diff --git a/README.md b/README.md index 6d17241c..637bd2ad 100644 --- a/README.md +++ b/README.md @@ -362,5 +362,6 @@ Use "yq [command] --help" for more information about a command. ## Known Issues / Missing Features - `yq` attempts to preserve comment positions and whitespace as much as possible, but it does not handle all scenarios (see https://github.com/go-yaml/yaml/tree/v3 for details) - Powershell has its own...[opinions on quoting yq](https://mikefarah.gitbook.io/yq/usage/tips-and-tricks#quotes-in-windows-powershell) +- "yes", "no" were dropped as boolean values in the yaml 1.2 standard - which is the standard yq assumes. See [tips and tricks](https://mikefarah.gitbook.io/yq/usage/tips-and-tricks) for more common problems and solutions. diff --git a/cmd/version.go b/cmd/version.go index 6a8f143b..8efc91cf 100644 --- a/cmd/version.go +++ b/cmd/version.go @@ -11,7 +11,7 @@ var ( GitDescribe string // Version is main version number that is being run at the moment. - Version = "v4.33.3" + Version = "v4.34.1" // VersionPrerelease is a pre-release marker for the version. If this is "" (empty string) // then it means that it is a final release. Otherwise, this is a pre-release diff --git a/go.mod b/go.mod index aecea1a6..b159b20e 100644 --- a/go.mod +++ b/go.mod @@ -15,7 +15,7 @@ require ( github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e github.com/spf13/cobra v1.7.0 github.com/spf13/pflag v1.0.5 - golang.org/x/net v0.9.0 + golang.org/x/net v0.10.0 golang.org/x/text v0.9.0 gopkg.in/op/go-logging.v1 v1.0.0-20160211212156-b2cb9fa56473 gopkg.in/yaml.v3 v3.0.1 @@ -25,7 +25,7 @@ require ( github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.17 // indirect - golang.org/x/sys v0.7.0 // indirect + golang.org/x/sys v0.8.0 // indirect golang.org/x/xerrors v0.0.0-20220609144429-65e65417b02f // indirect ) diff --git a/go.sum b/go.sum index a2704af3..0c38b597 100644 --- a/go.sum +++ b/go.sum @@ -50,11 +50,11 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -golang.org/x/net v0.9.0 h1:aWJ/m6xSmxWBx+V0XRHTlrYrPG56jKsLdTFmsSsCzOM= -golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= +golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= +golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= -golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/xerrors v0.0.0-20220609144429-65e65417b02f h1:uF6paiQQebLeSXkrTqHqz0MXhXXS1KgF41eUdBNvxK0= diff --git a/pkg/yqlib/doc/operators/boolean-operators.md b/pkg/yqlib/doc/operators/boolean-operators.md index 1d63155e..a1376f09 100644 --- a/pkg/yqlib/doc/operators/boolean-operators.md +++ b/pkg/yqlib/doc/operators/boolean-operators.md @@ -26,6 +26,24 @@ will output true ``` +## "yes" and "no" are strings +In the yaml 1.2 standard, support for yes/no as booleans was dropped - they are now considered strings. See '10.2.1.2. Boolean' in https://yaml.org/spec/1.2.2/ + +Given a sample.yml file of: +```yaml +- yes +- no +``` +then +```bash +yq '.[] | tag' sample.yml +``` +will output +```yaml +!!str +!!str +``` + ## `and` example Running ```bash diff --git a/pkg/yqlib/doc/operators/encode-decode.md b/pkg/yqlib/doc/operators/encode-decode.md index bcd7ee5c..2b7b3a39 100644 --- a/pkg/yqlib/doc/operators/encode-decode.md +++ b/pkg/yqlib/doc/operators/encode-decode.md @@ -25,7 +25,7 @@ See CSV and TSV [documentation](https://mikefarah.gitbook.io/yq/usage/csv-tsv) f XML uses the `--xml-attribute-prefix` and `xml-content-name` flags to identify attributes and content fields. -Base64 assumes [rfc4648](https://rfc-editor.org/rfc/rfc4648.html) encoding. Encoding and decoding both assume that the content is a string. +Base64 assumes [rfc4648](https://rfc-editor.org/rfc/rfc4648.html) encoding. Encoding and decoding both assume that the content is a utf-8 string and not binary content. ## Encode value as json string Given a sample.yml file of: diff --git a/pkg/yqlib/doc/operators/headers/encode-decode.md b/pkg/yqlib/doc/operators/headers/encode-decode.md index b5108de4..88e2a020 100644 --- a/pkg/yqlib/doc/operators/headers/encode-decode.md +++ b/pkg/yqlib/doc/operators/headers/encode-decode.md @@ -25,4 +25,4 @@ See CSV and TSV [documentation](https://mikefarah.gitbook.io/yq/usage/csv-tsv) f XML uses the `--xml-attribute-prefix` and `xml-content-name` flags to identify attributes and content fields. -Base64 assumes [rfc4648](https://rfc-editor.org/rfc/rfc4648.html) encoding. Encoding and decoding both assume that the content is a string. +Base64 assumes [rfc4648](https://rfc-editor.org/rfc/rfc4648.html) encoding. Encoding and decoding both assume that the content is a utf-8 string and not binary content. diff --git a/pkg/yqlib/doc/operators/headers/load.md b/pkg/yqlib/doc/operators/headers/load.md index 9989f2ff..d6ad6085 100644 --- a/pkg/yqlib/doc/operators/headers/load.md +++ b/pkg/yqlib/doc/operators/headers/load.md @@ -14,6 +14,8 @@ You can load files of the following supported types: | Plain String | load_str | | Base64 | load_base64 | +Note that load_base64 only works for base64 encoded utf-8 strings. + ## Samples files for tests: ### yaml diff --git a/pkg/yqlib/doc/operators/load.md b/pkg/yqlib/doc/operators/load.md index 2c6eae38..32d638ce 100644 --- a/pkg/yqlib/doc/operators/load.md +++ b/pkg/yqlib/doc/operators/load.md @@ -14,6 +14,8 @@ You can load files of the following supported types: | Plain String | load_str | | Base64 | load_base64 | +Note that load_base64 only works for base64 encoded utf-8 strings. + ## Samples files for tests: ### yaml diff --git a/pkg/yqlib/operator_booleans_test.go b/pkg/yqlib/operator_booleans_test.go index dc219ad1..c48c5307 100644 --- a/pkg/yqlib/operator_booleans_test.go +++ b/pkg/yqlib/operator_booleans_test.go @@ -12,6 +12,16 @@ var booleanOperatorScenarios = []expressionScenario{ "D0, P[], (!!bool)::true\n", }, }, + { + description: "\"yes\" and \"no\" are strings", + subdescription: "In the yaml 1.2 standard, support for yes/no as booleans was dropped - they are now considered strings. See '10.2.1.2. Boolean' in https://yaml.org/spec/1.2.2/", + document: `[yes, no]`, + expression: `.[] | tag`, + expected: []string{ + "D0, P[0], (!!str)::!!str\n", + "D0, P[1], (!!str)::!!str\n", + }, + }, { skipDoc: true, document: "b: hi", diff --git a/release_notes.txt b/release_notes.txt index a7e2b363..3b1a79a2 100644 --- a/release_notes.txt +++ b/release_notes.txt @@ -1,3 +1,8 @@ +4.34.1: + - Added shell output format thanks @giorgiga + - Fixed nil pointer dereference (#1649) thanks @ArthurFritz + - Bumped dependency versions + 4.33.3: - Fixed bug when splatting empty array #1613 - Added scalar output for TOML (#1617) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 39224575..ea9a14a0 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -1,5 +1,5 @@ name: yq -version: 'v4.33.3' +version: 'v4.34.1' summary: A lightweight and portable command-line YAML processor description: | The aim of the project is to be the jq or sed of yaml files.