| 1 |
# oh: OxygenHub from the command line |
| 2 |
|
| 3 |
`oh` is to OxygenHub what `gh` is to GitHub. It talks to the hub's JSON API |
| 4 |
(hub spec §12) and prints what it gets back: in colour on a terminal, as |
| 5 |
plain text with `--plain` or `NO_COLOR`, and as the API's own JSON with |
| 6 |
`--json`. |
| 7 |
|
| 8 |
## Which hub, which repository, which token |
| 9 |
|
| 10 |
Inside an Oxygen checkout, `oh` uses the checkout's remote: |
| 11 |
- **Remote:** `origin`, or the only remote, or `--remote NAME`. |
| 12 |
- **Hub and repository:** from the remote's URL (`https://hub/OWNER/NAME`). |
| 13 |
- **Token and CA:** the ones `oxy` pushes with (`remote.NAME.token`, `remote.NAME.ca`). |
| 14 |
|
| 15 |
So in a checkout that pushes to the hub, `oh` needs no setup. |
| 16 |
|
| 17 |
Elsewhere, sign in once and name the repository: |
| 18 |
|
| 19 |
``` |
| 20 |
oh auth login --with-hub https://earth.andymccall.xyz:7343 --ca ~/.config/oxy/earth-ca.pem |
| 21 |
oh issue list --repo andymccall/oxygen |
| 22 |
``` |
| 23 |
|
| 24 |
`oh auth login` checks the token, saves it with the CA in |
| 25 |
`~/.config/oh/config.toml` (owner-only), and makes that hub the default. It |
| 26 |
reads the token from stdin unless `--token` is given. `OH_TOKEN` (or |
| 27 |
`OXY_TOKEN`), `OH_HUB` and `OXY_CA` override the saved values. |
| 28 |
|
| 29 |
## Commands |
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
| `oh auth login`, `oh auth status` | Save a token; show who you are | |
| 34 |
| `oh repo view` | Name, description, visibility, default bookmark, clone command | |
| 35 |
| `oh issue list [--state open\|closed\|all]` | Issues | |
| 36 |
| `oh issue view N` | An issue with its comments | |
| 37 |
| `oh issue create -t TITLE [-b BODY \| -F FILE] [-l LABEL]…` | Open an issue | |
| 38 |
| `oh issue close N [--reason not_planned]`, `oh issue reopen N` | Close or reopen | |
| 39 |
| `oh issue comment N -b BODY` | Comment | |
| 40 |
| `oh proposal list [--state open\|draft\|landed\|closed\|all]`, `oh proposal view N` | Proposals, with changes, approvals and blockers; a landed one with who landed it and how | |
| 41 |
| `oh proposal create -t TITLE --from BOOKMARK [--into BOOKMARK] [--draft]` | Propose a bookmark's changes | |
| 42 |
| `oh proposal checks N` | Checks on the projected state | |
| 43 |
| `oh proposal land N` | Land it on its target, as the page's Land button does | |
| 44 |
| `oh run list`, `oh run view N` | OxygenFlow runs and their jobs | |
| 45 |
| `oh run start [--bookmark B \| --change HASH] [--watch]` | Run the pipeline without a push | |
| 46 |
| `oh run watch N` | Follow a run; exit 0 if it passes, 1 if not | |
| 47 |
| `oh run log N JOB` | A job's log | |
| 48 |
| `oh run rerun N` | Run a finished run's state again | |
| 49 |
| `oh release list`, `oh release create TAG [-t TITLE] [-n NOTES]` | Releases | |
| 50 |
| `oh release upload TAG FILE…` | Attach assets | |
| 51 |
| `oh release trust TAG` | The release's trust audit; exit 1 on a failure | |
| 52 |
| `oh api PATH [-X METHOD] [-d JSON]` | Any API call, JSON out | |
| 53 |
|
| 54 |
Exit codes: 0 on success, 1 when a watched run or an audit fails, 2 on an |
| 55 |
error. |
| 56 |
|
| 57 |
## Not yet |
| 58 |
|
| 59 |
- Also still to come: reviews, labels and milestones as commands, runner management (oxygenhub#41), and shell completions. |