mirror of
https://gitea.com/gitea/docs.git
synced 2026-11-05 17:45:46 +00:00
Cover what users need to get going and leave the details to gt <command> --help and gt help. Signed-off-by: bircni <[email protected]>
23 lines
744 B
Markdown
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.
|