Many commands in watermint toolbox generate reports with tabular data. There are three powerful features that can extend and modify command output for advanced reporting needs:
By default, commands display only the most commonly used columns to keep output readable. However, many commands have additional hidden columns that can be revealed using the experimental flag.
go run . [command] -experimental report_all_columns
Standard output (limited columns):
go run . dropbox team member list
Shows: Email, Status, Role, etc.
Extended output (all columns):
go run . dropbox team member list -experimental report_all_columns
Shows: Email, Status, Role, Team Member ID, Account ID, External ID, Profile, Date Joined, Groups, etc.
This reveals internal IDs and metadata that are often needed for automation and integration scenarios.
The output filter option allows you to run queries on command results using a SQL-like syntax. This requires -output json
to be specified.
go run . [command] -output json -output-filter "query expression"
select
: Choose columns to displaywhere
: Filter rows based on conditionsorder by
: Sort resultslimit
: Limit number of resultsFilter active team members:
go run . dropbox team member list -output json -output-filter "select email, status where status = 'active'"
Find members by domain:
go run . dropbox team member list -output json -output-filter "select email, team_member_id where email like '%@company.com'"
Get top 10 largest files:
go run . dropbox file list -output json -output-filter "select name, size order by size desc limit 10"
The util json query
command provides jq-like functionality for processing JSON output from other commands. It’s particularly useful for complex data transformations.
go run . [command] -output json | go run . util json query -query "jq expression"
Extract specific fields:
go run . dropbox team member list -output json | go run . util json query -query ".[] | {email, team_member_id}"
Group and count:
go run . dropbox team member list -output json | go run . util json query -query "group_by(.status) | map({status: .[0].status, count: length})"
Filter and transform:
go run . dropbox file list -output json | go run . util json query -query ".[] | select(.size > 1000000) | .name"
A common administrative task is to generate a report of all team member IDs with email addresses. Here’s how to accomplish this using the three features:
go run . dropbox team member list -experimental report_all_columns -output json
go run . dropbox team member list -experimental report_all_columns -output json -output-filter "select team_member_id, email"
go run . dropbox team member list -experimental report_all_columns -output json | go run . util json query -query ".[] | {team_member_id, email}"
go run . dropbox team member list -experimental report_all_columns -output csv -output-filter "select team_member_id, email" > team_members.csv
Always start with -experimental report_all_columns
to see what data is available:
go run . [command] -experimental report_all_columns | head -5
For straightforward filtering and column selection, -output-filter
is more efficient:
# Good for simple cases
go run . dropbox team member list -output json -output-filter "select email where status = 'active'"
For complex transformations, aggregations, or when you need jq’s full power:
# Good for complex cases
go run . dropbox team member list -output json | go run . util json query -query "group_by(.role) | map({role: .[0].role, members: map(.email)})"
These features integrate well with standard Unix tools:
# Count active members
go run . dropbox team member list -output json -output-filter "select email where status = 'active'" | jq length
# Sort and save
go run . dropbox team member list -output csv -output-filter "select email, team_member_id order by email" > sorted_members.csv
-experimental report_all_columns
may return more data and take slightly longer-output-filter
is processed server-side and is generally faster for large datasetsutil json query
processes data client-side and is better for complex transformations-output-filter
to reduce data transferColumn not found in output-filter:
# First check available columns
go run . [command] -experimental report_all_columns | head -1
JSON parsing errors:
# Ensure -output json is specified
go run . [command] -output json -output-filter "..."
Complex jq expressions:
# Test expressions incrementally
go run . [command] -output json | go run . util json query -query ".[0]" # First record
go run . [command] -output json | go run . util json query -query ".[] | keys" # Available fields
These advanced reporting features provide powerful ways to extract, filter, and transform data from watermint toolbox commands, enabling sophisticated reporting and automation workflows.