From 2a1b2b8e149ce631dfaea3098fee4458ef159212 Mon Sep 17 00:00:00 2001 From: Ahmet DEMIR Date: Thu, 28 May 2020 17:12:46 +0200 Subject: [PATCH] add todo and tips in doc --- .travis.yml | 2 +- README.md | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index d965e3a..ce34819 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,5 +21,5 @@ deploy: password: secure: "zoklW1G25tsz1TCIXThHyUpQh6x72DpmrxW4dCPp4Nw1eNuPgtr3V374bo980OLupf+XKcoCAjVA6i6JP2dhrkLrw4vdbZo6+KERsrRczfhdvfXJ+rQ4gA0ODMMhXKISKmLSoB4QWCDk7z5af0mccHB5HvNOebnCTOH46F5TMoVvIHduu5I9VNy+8ZMvL5mjYtyok/+sryl5LfBgIwfcc4ZQiBX/zmj1iE37jwfG+e6NH1QWmy/MwHVmK58UkER6O5U9TV7rbbn/zyYw9Kov+Tmg8fFfJ2x8WytewEIfpF7XWuH5cMm/0t4q5o2OzBj9TP/aFCp5+JR5C7TgAboRb22aYD5HJLCE67r2uHiY0F0X3hBmacdI5gHoA72InVejHlArnXYEsrio1joTMw3uCuy5oVDMRTefku/kjLhE9q+Agx3lXhjnzvzPBiURDf7yWkoO7ede9XCTcDWWQk1WXZPHW3U+BbiucVJoLnfUiFdAX1xDVsUaSyYFjZsS1xhogA9Lh8S2IRuojkNuKG7uvhoI3pzyx7r50WDrDnvofRVZ8rz7txrNn3VhjUA4X/v8AfuM2q64Cy83eR7OzjPk5mNrbQ6U5TFUA6M12wnz+HwyQBnXWLFBo6xbIzDySPCb99ZdmZwvaIF8fJ3TXYFIkahURW8P3ZJK1caGS1gkkGo=" on: - python: 3.6 + tags: true distributions: "bdist_wheel" diff --git a/README.md b/README.md index d3a78b5..858abd3 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,8 @@ pip install wildq wildq [--yaml|--json|--toml|--ini|--xml|--hcl> [file] ``` +There is also a shorter command `wq` comming with the package. + Output is similar to `jq -MCr` (no color, no compact and no quote on single value) Like `jq cli`, wildq supports both of stdin and file to the function @@ -72,6 +74,18 @@ wildq --json ".keys[]" examples/json.json } alone ``` +or + +```sh +wq --json ".keys[]" examples/json.json +{ + "key": "value1" +} +{ + "key": "value2" +} +alone +``` For TOML ```sh @@ -140,6 +154,25 @@ cat examples/hcl.hcl | wildq --hcl ".keys[]" } ``` +## Tips and tricks + +Loop on keys in bash without creating a subshell + +```sh +wildq --toml "keys[]" examples/toml.toml | while read -r key +do + echo "Getting key ${key}" +done +``` + +## TODO + +- [ ] support all jq types +- [ ] add tests... +- [ ] add more control over filters and files +- [ ] detect automagically filetype +- [ ] use click for the CLI + ## Contributing Merge requests are welcome :)