watermint toolbox - The multi-purpose utility command-line tool for web services

Release 136

Release theme

  • Remove deprecated commands as announced in #835, #796
  • Remove alias of old command paths as announced in #797, #799

#872 - Output filter option

This feature allows you to filter the output of the command. This is useful if you want to process the output in a specific format. In addition, in some cases, data in JSON format contains more data. If you want to retrieve such hidden data, this option will help you to extract it as a report.

For example, the command dropbox team member list returns a list of team members. JSON report contains raw data from the Dropbox API. If you want to extract only the email address and the verification status of the team members, you can use the output filter option.

$ ./tbx dropbox team member list -output json --output-filter "[.profile.email, .profile.email_verified]"
["sugito@example.com", true]
["kajiwara@example.com", true]
["takimoto@example.com", false]
["ueno@example.com", true]
["tomioka@example.com", false]

Then, if you want to format this data as a CSV, you can use the @csv filter like this:

$ ./tbx dropbox team member list -output json --output-filter "[.profile.email, .profile.email_verified] | @csv"
"sugito@example.com",true
"kajiwara@example.com",true
"takimoto@example.com",false
"ueno@example.com",true
"tomioka@example.com",false

In case you want to test the output filter, you can run the command first without the output filter option. The command will generate the raw JSON output. Then, you can test the query the command util json query to test the query.

$ ./tbx dropbox team member list
watermint toolbox xxx.x.xxx
===========================

© 2016-2024 Takayuki Okazaki
Licensed under open source licenses. Use the `license` command for more detail.

....snip...

The report generated: /Users/YOU/.toolbox/jobs/20240824-012959.EHJ/report/member.csv
The report generated: /Users/YOU/.toolbox/jobs/20240824-012959.EHJ/report/member.json
The report generated: /Users/YOU/.toolbox/jobs/20240824-012959.EHJ/report/member.xlsx

In this case, the JSON report is generated in the path /Users/YOU/.toolbox/jobs/20240824-012959.EHJ/report/member.json. You can use this file to test the output filter. The report is generated in the JSON Lines format. You need to use the -lines option to read the file.

$ ./tbx util json query -lines -path /Users/YOU/.toolbox/jobs/20240824-012959.EHJ/report/member.json -query "[.profile.email, .profile.email_verified] | @csv"
"sugito@example.com",true
"kajiwara@example.com",true
"takimoto@example.com",false
"ueno@example.com",true
"tomioka@example.com",false

Changes

Documents

Binary

File name File size MD5 hash SHA256 hash
tbx-136.8.271-linux-arm.zip 21709314 3ea71adbe821e5d4b588ab7a2120cea2 31695b77c1903132e13b3e085c1c2855ae8723019436a7426ce9fed0ffa0abd0
tbx-136.8.271-linux-intel.zip 22920669 ecac92eaa17ef543e4cda76ce6fa6392 506d7701ecbfb4a9d57f77d2343052ad1714be6cd0a9a5e9be5d0e2f372caba5
tbx-136.8.271-mac-applesilicon.zip 22250931 4a87d034bf5e28e9ce9e1d44a1ef2e5c c820758eb5024111c110165df4a8b40a02b601dea035c592231e0e81f5fda9e8
tbx-136.8.271-mac-intel.zip 23138050 ef36587f063fe8ef6102dc3ffd1772b3 227d49a14e08d7458cd14f7568d213177eca4541ab4cf0f074dca5d97a683a3e
tbx-136.8.271-win.zip 23228543 33265e40133ce6462b51deb130595449 78c81211303a7c202c2d80e12c7676f6ead1c2e2ae53d0ef2e41a66bf09702ee
}