030 / go-yq Goto Github PK
View Code? Open in Web Editor NEWjq-style golang equivalent of yq
License: MIT License
jq-style golang equivalent of yq
License: MIT License
[user@localhost go-yq]$ go run main.go firefox_checksum ~/dev/ansible-firefox/defaults/main.yml
sha512:49d776cfb5f42c6e5ea1a55a80d9f6bad223080b16baa0d39de63534c25e68340091b4e16be5355d565f81291cb94fb996f03ae7e3e4c7a28021b0a0929daf58
partial match
[user@localhost go-yq]$ go run main.go irefox_checksum ~/dev/ansible-firefox/defaults/main.yml
sha512:49d776cfb5f42c6e5ea1a55a80d9f6bad223080b16baa0d39de63534c25e68340091b4e16be5355d565f81291cb94fb996f03ae7e3e4c7a28021b0a0929daf58
show version
replace the test.yaml by constructing a yaml file using a yaml parser and cleaning it up when the test has been completed
Currently you only provide linux binaries, can you also provide binaries for macOS?
go-yq '.a.b'
does not match
a:
- b:
- c: 123
d: 456
e:
f: 789
aa:
- bb: 111
cc: 222
dd: 333
When I search for kid1
in the following yaml:
men: [John Smith, Bill Jones]
women:
- Mary Smith
- Susan Williams
kid:
kid1: jan
kid1: piet
The output is piet
. I'm not sure what to expect, but at least this behaviour should be documented.
example
a: halloAllemaal # yamllint disable-line
should return
halloAllemaal
Expected: exit 1 if key not found
Actual: exit 0
Tool should comply to the jq policy, i.e. using dots, e.g. yq .foo.bar input.yml
In this example yaml file (taken from Wikipedia)
men: [John Smith, Bill Jones]
women:
- Mary Smith
- Susan Williams
I get the unexpected output:
$ go-yq-1.1.1-darwin -yamlFile women.yml -key women
2018/11/12 12:09:35 File: women.yml does not contain key: women
For the key men
it does work:
$ go-yq-1.1.1-darwin -yamlFile women.yml -key men
[John Smith, Bill Jones]
use golang yaml parser
alpine 3.12
In order to verify the downloaded binaries it would be nice if you can add checksum files.
./go-yq -yamlFile defaults/main.yml -key checksum3
results in:
2018/11/11 13:14:35 Cannot extract value for key, but was: 'checksum3: 7e3e4c7a28021b0a0929daf58' please check whether the regex matches the key
Hey just saw your post on jq, I also have a go implementation:
https://github.com/mikefarah/yq
I have a bunch of outstanding things to do - not sure if you're interested in helping out!
If not - no worries
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.