CLI
The hangar CLI mirrors the API surface and follows standard CLI conventions: --help everywhere, human-readable tables by default, --json for scripting, and confirmation on destructive actions.
Install & log in
go build -o hangar ./cmd/hangar-cli # or grab a release binary
hangar login --token hgp_your_token
hangar account:switch acct_123
Config and token live at ~/.hangar (override with $HANGAR_CONFIG). $HANGAR_API, $HANGAR_TOKEN, and $HANGAR_ACCOUNT override the file. NO_COLOR and non-TTY output are respected.
Common commands
hangar app:list # list apps in the current account
hangar app:show app_123 --json # one app, as JSON
hangar deploy app_123 --git-sha abc # trigger a deployment
hangar deploy:list app_123 # deployment history
hangar env:set app_123 SECRET v --secret
hangar db:list
hangar server:list
hangar app:delete app_123 --force # skip the confirmation prompt
Exit codes
| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | Runtime / API error |
| 2 | Usage error (bad flags or arguments) |
| 3 | Authentication / authorization error (401/403) |
| 4 | Not found (404) |