Skip to main content

Scripting & output

The CLI is designed to be piped, scripted, and dropped into CI. Output format, filtering, and bulk operations all work the same way for every command.

Output formats​

dimescheduler resources list # default: table in a TTY, json when piped
dimescheduler resources list --output json
dimescheduler resources list --output yaml
dimescheduler resources list -o table

The default switches automatically - JSON when stdout isn't a terminal, table when it is - just like kubectl, gh, and stripe. That means you can pipe to jq without juggling flags:

dimescheduler resources list | jq '.[] | select(.disabled == false) | .name'

Override the default globally with DIMESCHEDULER_OUTPUT=json or per call with --output.

Built-in --jq​

For one-off filters, the CLI ships with --jq built in, so you don't need to install jq separately:

dimescheduler resources list --jq '.[] | select(.disabled == false) | .name'
dimescheduler appointments list --from 2026-05-01T00:00:00Z --to 2026-05-31T23:59:59Z \
--jq 'map(.appointmentNo)'

--jq implies --output json and runs the expression in-process.

Bulk operations​

Every create, update, and delete command accepts --body-file for batch payloads:

# Create many tasks at once
dimescheduler tasks create --body-file ./tasks.json

# Update many resources
dimescheduler resources update --body-file ./resources.yaml

The file can be JSON or YAML - the CLI detects the format for you. For quick inline bodies, use --body:

dimescheduler categories create --body '{"name":"VIP","color":"#22d3ee"}'

The flag-based shorthand (--name, --color, …) is the handiest choice for one-off CRUD. For bulk loads, the file route is faster, safer, and reviewable.

Piping between commands​

Output one command's results into the next without writing temp files:

# Lock every appointment in a date range
dimescheduler appointments list --from 2026-05-01T00:00:00Z --to 2026-05-01T23:59:59Z \
--jq 'map({appointmentNo: .appointmentNo, locked: true})' \
| dimescheduler appointment-locked create --body-file -

# Soft-delete every resource flagged inactive
dimescheduler resources list --jq 'map(select(.disabled == true) | {resourceNo})' \
| dimescheduler resources delete --body-file -

--body-file - reads from stdin.

CI patterns​

In a non-interactive shell, the CLI:

  • Reads credentials from DIMESCHEDULER_API_KEY (and other DIMESCHEDULER_* env vars).
  • Defaults --output to json, so post-processing is predictable.
  • Returns one of the documented exit codes (see Commands).

A typical pipeline step:

- name: Sync resources to sandbox
env:
DIMESCHEDULER_API_KEY: ${{ secrets.DS_SANDBOX_KEY }}
DIMESCHEDULER_ENVIRONMENT: sandbox
run: dimescheduler resources update --body-file ./resources.json

Use --quiet if you only want errors to land in the log:

dimescheduler resources update --body-file ./resources.json --quiet

Debugging​

When something looks off, --debug prints every HTTP request and response to stderr:

dimescheduler resources list --debug 2> debug.log

--verbose is lighter: progress, redirects, retry attempts, but no payload dumps.

If the server is returning unexpected errors, the api escape hatch lets you reproduce them at the raw HTTP level:

dimescheduler api GET /resource --debug