mirror of
https://github.com/mikefarah/yq.git
synced 2026-07-07 22:35:37 +00:00
Compare commits
1 Commits
fff810cb9a
...
865246be3c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
865246be3c |
4
go.mod
4
go.mod
@ -14,8 +14,8 @@ require (
|
|||||||
github.com/magiconair/properties v1.8.10
|
github.com/magiconair/properties v1.8.10
|
||||||
github.com/pelletier/go-toml/v2 v2.2.4
|
github.com/pelletier/go-toml/v2 v2.2.4
|
||||||
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e
|
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e
|
||||||
github.com/spf13/cobra v1.10.1
|
github.com/spf13/cobra v1.9.1
|
||||||
github.com/spf13/pflag v1.0.9
|
github.com/spf13/pflag v1.0.7
|
||||||
github.com/yuin/gopher-lua v1.1.1
|
github.com/yuin/gopher-lua v1.1.1
|
||||||
go.yaml.in/yaml/v3 v3.0.4
|
go.yaml.in/yaml/v3 v3.0.4
|
||||||
golang.org/x/net v0.43.0
|
golang.org/x/net v0.43.0
|
||||||
|
|||||||
9
go.sum
9
go.sum
@ -40,10 +40,11 @@ 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 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
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/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||||
github.com/spf13/cobra v1.10.1 h1:lJeBwCfmrnXthfAupyUTzJ/J4Nc1RsHC/mSRU2dll/s=
|
github.com/spf13/cobra v1.9.1 h1:CXSaggrXdbHK9CF+8ywj8Amf7PBRmPCOJugH954Nnlo=
|
||||||
github.com/spf13/cobra v1.10.1/go.mod h1:7SmJGaTHFVBY0jW4NXGluQoLvhqFQM+6XSKD+P4XaB0=
|
github.com/spf13/cobra v1.9.1/go.mod h1:nDyEzZ8ogv936Cinf6g1RU9MRY64Ir93oCnqb9wxYW0=
|
||||||
github.com/spf13/pflag v1.0.9 h1:9exaQaMOCwffKiiiYk6/BndUBv+iRViNW+4lEMi0PvY=
|
github.com/spf13/pflag v1.0.6/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||||
github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
github.com/spf13/pflag v1.0.7 h1:vN6T9TfwStFPFM5XzjsvmzZkLuaLX+HS+0SeFLRgU6M=
|
||||||
|
github.com/spf13/pflag v1.0.7/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
|
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
|
||||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||||
|
|||||||
@ -282,13 +282,13 @@ func (dec *tomlDecoder) processTable(currentNode *toml.Node) (bool, error) {
|
|||||||
tableValue = dec.parser.Expression()
|
tableValue = dec.parser.Expression()
|
||||||
// next expression is not table data, so we are done
|
// next expression is not table data, so we are done
|
||||||
if tableValue.Kind != toml.KeyValue {
|
if tableValue.Kind != toml.KeyValue {
|
||||||
log.Debug("got an empty table")
|
log.Debug("got an empty table, returning")
|
||||||
runAgainstCurrentExp = true
|
return true, nil
|
||||||
} else {
|
}
|
||||||
runAgainstCurrentExp, err = dec.decodeKeyValuesIntoMap(tableNodeValue, tableValue)
|
|
||||||
if err != nil && !errors.Is(err, io.EOF) {
|
runAgainstCurrentExp, err = dec.decodeKeyValuesIntoMap(tableNodeValue, tableValue)
|
||||||
return false, err
|
if err != nil && !errors.Is(err, io.EOF) {
|
||||||
}
|
return false, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -23,7 +23,6 @@ street = "first street"
|
|||||||
[owner]
|
[owner]
|
||||||
name = "Tom Preston-Werner"
|
name = "Tom Preston-Werner"
|
||||||
`
|
`
|
||||||
|
|
||||||
var expectedTableArrayBeforeOwners = `owner:
|
var expectedTableArrayBeforeOwners = `owner:
|
||||||
addresses:
|
addresses:
|
||||||
- street: first street
|
- street: first street
|
||||||
@ -68,29 +67,6 @@ var emptyTable = `
|
|||||||
|
|
||||||
var emptyTableExpected = "dependencies: {}\n"
|
var emptyTableExpected = "dependencies: {}\n"
|
||||||
|
|
||||||
var multipleEmptyTables = `
|
|
||||||
[firstEmptyTable]
|
|
||||||
[firstTableWithContent]
|
|
||||||
key = "value"
|
|
||||||
[secondEmptyTable]
|
|
||||||
[thirdEmptyTable]
|
|
||||||
[secondTableWithContent]
|
|
||||||
key = "value"
|
|
||||||
[fourthEmptyTable]
|
|
||||||
[fifthEmptyTable]
|
|
||||||
`
|
|
||||||
|
|
||||||
var expectedMultipleEmptyTables = `firstEmptyTable: {}
|
|
||||||
firstTableWithContent:
|
|
||||||
key: value
|
|
||||||
secondEmptyTable: {}
|
|
||||||
thirdEmptyTable: {}
|
|
||||||
secondTableWithContent:
|
|
||||||
key: value
|
|
||||||
fourthEmptyTable: {}
|
|
||||||
fifthEmptyTable: {}
|
|
||||||
`
|
|
||||||
|
|
||||||
var sampleWithHeader = `
|
var sampleWithHeader = `
|
||||||
[servers]
|
[servers]
|
||||||
|
|
||||||
@ -262,13 +238,6 @@ var tomlScenarios = []formatScenario{
|
|||||||
expected: expectedSampleWithHeader,
|
expected: expectedSampleWithHeader,
|
||||||
scenarioType: "decode",
|
scenarioType: "decode",
|
||||||
},
|
},
|
||||||
{
|
|
||||||
description: "Parse: multiple empty tables",
|
|
||||||
skipDoc: true,
|
|
||||||
input: multipleEmptyTables,
|
|
||||||
expected: expectedMultipleEmptyTables,
|
|
||||||
scenarioType: "decode",
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func testTomlScenario(t *testing.T, s formatScenario) {
|
func testTomlScenario(t *testing.T, s formatScenario) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user