Merge branch 'master' into generic_ast

This commit is contained in:
Mike Farah 2023-04-11 12:10:29 +10:00
commit b74edd43da
11 changed files with 37 additions and 16 deletions

View File

@ -1,4 +1,4 @@
FROM golang:1.20.2 as builder
FROM golang:1.20.3 as builder
WORKDIR /go/src/mikefarah/yq

View File

@ -1,4 +1,4 @@
FROM golang:1.20.2
FROM golang:1.20.3
COPY scripts/devtools.sh /opt/devtools.sh

View File

@ -47,7 +47,7 @@ yq -i '
Convert JSON to YAML
```bash
yq -P sample.json
yq -Poy sample.json
```
See the [documentation](https://mikefarah.gitbook.io/yq/) for more examples.

View File

@ -11,7 +11,7 @@ var (
GitDescribe string
// Version is main version number that is being run at the moment.
Version = "v4.33.2"
Version = "v4.33.3"
// 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

6
go.mod
View File

@ -8,12 +8,12 @@ require (
github.com/elliotchance/orderedmap v1.5.0
github.com/fatih/color v1.15.0
github.com/goccy/go-json v0.10.2
github.com/goccy/go-yaml v1.10.1
github.com/goccy/go-yaml v1.11.0
github.com/jinzhu/copier v0.3.5
github.com/magiconair/properties v1.8.7
github.com/pelletier/go-toml/v2 v2.0.7
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e
github.com/spf13/cobra v1.6.1
github.com/spf13/cobra v1.7.0
github.com/spf13/pflag v1.0.5
golang.org/x/net v0.8.0
gopkg.in/op/go-logging.v1 v1.0.0-20160211212156-b2cb9fa56473
@ -21,7 +21,7 @@ require (
)
require (
github.com/inconshreveable/mousetrap v1.0.1 // indirect
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.6.0 // indirect

12
go.sum
View File

@ -17,11 +17,11 @@ github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs=
github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw=
github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU=
github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
github.com/goccy/go-yaml v1.10.1 h1:neijiyxgQOmEyVw8ZsDxcCzkU3NJ5NS+q7xmnOcd8UQ=
github.com/goccy/go-yaml v1.10.1/go.mod h1:H+mJrWtjPTJAHvRbV09MCK9xYwODM+wRTVFFTWckfng=
github.com/goccy/go-yaml v1.11.0 h1:n7Z+zx8S9f9KgzG6KtQKf+kwqXZlLNR2F6018Dgau54=
github.com/goccy/go-yaml v1.11.0/go.mod h1:H+mJrWtjPTJAHvRbV09MCK9xYwODM+wRTVFFTWckfng=
github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM=
github.com/inconshreveable/mousetrap v1.0.1 h1:U3uMjPSQEBMNp1lFxmllqCPM6P5u/Xq7Pgzkat/bFNc=
github.com/inconshreveable/mousetrap v1.0.1/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/jinzhu/copier v0.3.5 h1:GlvfUwHk62RokgqVNvYsku0TATCF7bAHVwEXoBh3iJg=
github.com/jinzhu/copier v0.3.5/go.mod h1:DfbEm0FYsaqBcKcFuvmOZb218JkPGtvSHsKg8S8hyyg=
github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY=
@ -38,8 +38,8 @@ github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsK
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/spf13/cobra v1.6.1 h1:o94oiPyS4KD1mPy2fmcYYHHfCxLqYjJOhGsCHFZtEzA=
github.com/spf13/cobra v1.6.1/go.mod h1:IOw/AERYS7UzyrGinqmz6HLUo219MORXGxhbaJUqzrY=
github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I=
github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=

View File

@ -14,6 +14,13 @@ var collectObjectOperatorScenarios = []expressionScenario{
"D0, P[], (!!map)::dog: great\n",
},
},
{
skipDoc: true,
expression: `({} + {}) | (.b = 3)`,
expected: []string{
"D0, P[], (!!map)::b: 3\n",
},
},
{
skipDoc: true,
document: "a: []",

View File

@ -5,12 +5,12 @@ func pipeOperator(d *dataTreeNavigator, context Context, expressionNode *Express
if expressionNode.LHS.Operation.OperationType == assignVariableOpType {
return variableLoop(d, context, expressionNode)
}
lhs, err := d.GetMatchingNodes(context, expressionNode.LHS)
if err != nil {
return Context{}, err
}
rhs, err := d.GetMatchingNodes(lhs, expressionNode.RHS)
rhsContext := context.ChildContext(lhs.MatchingNodes)
rhs, err := d.GetMatchingNodes(rhsContext, expressionNode.RHS)
if err != nil {
return Context{}, err
}

View File

@ -21,6 +21,14 @@ var pipeOperatorScenarios = []expressionScenario{
"D0, P[], (doc)::{a: cat, b: dog, c: same}\n",
},
},
{
skipDoc: true,
description: "Don't pass readonly context",
expression: `(3 + 4) | ({} | .b = "dog")`,
expected: []string{
"D0, P[], (!!map)::b: dog\n",
},
},
}
func TestPipeOperatorScenarios(t *testing.T) {

View File

@ -1,3 +1,9 @@
4.33.3:
- Fixed bug when splatting empty array #1613
- Added scalar output for TOML (#1617)
- Fixed passing of readonly context in pipe (partial fix for #1631)
- Bumped dependency versions
4.33.2:
- Add ``--nul-output|-0`` flag to separate element with NUL character (#1550) Thanks @vaab!
- Add removable-media interface plug declaration to the snap packaging(#1618) Thanks @brlin-tw!

View File

@ -1,5 +1,5 @@
name: yq
version: 'v4.33.2'
version: 'v4.33.3'
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.