mirror of
https://github.com/mikefarah/yq.git
synced 2024-11-12 13:48:06 +00:00
more bits
This commit is contained in:
parent
35fd5b7ae4
commit
a3f8f9df10
@ -103,6 +103,18 @@ func TestReadWithAdvancedFilterCmd(t *testing.T) {
|
||||
test.AssertResult(t, "4", result.Output)
|
||||
}
|
||||
|
||||
func TestReadWithAdvancedFilterMapCmd(t *testing.T) {
|
||||
cmd := getRootCommand()
|
||||
result := test.RunCmd(cmd, "read -v examples/sample.yaml b.e[name==fred]")
|
||||
if result.Error != nil {
|
||||
t.Error(result.Error)
|
||||
}
|
||||
expectedOutput := `name: fred
|
||||
value: 3
|
||||
`
|
||||
test.AssertResult(t, expectedOutput, result.Output)
|
||||
}
|
||||
|
||||
func TestReadWithKeyAndValueCmd(t *testing.T) {
|
||||
cmd := getRootCommand()
|
||||
result := test.RunCmd(cmd, "read -p pv examples/sample.yaml b.c")
|
||||
|
3
yq.go
3
yq.go
@ -100,6 +100,7 @@ yq read things.yaml a.b.c
|
||||
yq r - a.b.c (reads from stdin)
|
||||
yq r things.yaml a.*.c
|
||||
yq r things.yaml a.**.c
|
||||
yq r things.yaml a.(child.subchild==cool).c
|
||||
yq r -d1 things.yaml 'a.array[0].blah'
|
||||
yq r things.yaml 'a.array[*].blah'
|
||||
yq r -- things.yaml --key-starting-with-dashes.blah
|
||||
@ -121,6 +122,7 @@ func createWriteCmd() *cobra.Command {
|
||||
yq write things.yaml a.b.c true
|
||||
yq write things.yaml 'a.*.c' true
|
||||
yq write things.yaml 'a.**' true
|
||||
yq write things.yaml a.(child.subchild==cool).c true
|
||||
yq write things.yaml a.b.c --tag '!!str' true
|
||||
yq write things.yaml a.b.c --tag '!!float' 3
|
||||
yq write --inplace -- things.yaml a.b.c --cat
|
||||
@ -187,6 +189,7 @@ func createDeleteCmd() *cobra.Command {
|
||||
Example: `
|
||||
yq delete things.yaml a.b.c
|
||||
yq delete things.yaml a.*.c
|
||||
yq delete things.yaml a.(child.subchild==cool).c
|
||||
yq delete things.yaml a.**
|
||||
yq delete --inplace things.yaml a.b.c
|
||||
yq delete --inplace -- things.yaml --key-starting-with-dash
|
||||
|
Loading…
Reference in New Issue
Block a user