Files
docs/cli-docs/scripting.md
T
bircni 31cd47a65c docs: shorten the gt guides
Cover what users need to get going and leave the details to
gt <command> --help and gt help.

Signed-off-by: bircni <[email protected]>
2026-10-22 18:34:04 +02:00

23 lines
744 B
Markdown

---
sidebar_position: 5
---
# Output and scripting
Scripts should read JSON: the text output is meant for people and may change.
```bash
gt pr view 123 --json number,title,state
gt issue list --json number,title --jq '.[] | "\(.number)\t\(.title)"'
```
`--json` prints all fields or the ones you list; the **JSON FIELDS** section of a command's
`--help` names them. `--jq` filters the result without needing jq installed. Piped lists
print as tab-separated values.
gt exits with 0 on success, 1 when a command fails, 2 on a usage error and 4 when
authentication is missing or rejected; `gt help exit-codes` lists all codes.
`gt api` calls any API endpoint with gt's login, and `gt alias set` defines shortcuts for
commands you use often.