# `quinjet pr open`
Hands a pull request's URL to the desktop browser.
Usage:
```bash
quinjet pr open <number> [--repo <owner/name>] [--refresh] [-C <DIR>] [--json]
```
Arguments:
| `<NUMBER>` | unsigned integer | required | The pull-request number. |
Options:
| `--repo <OWNER/NAME>` | string | unset | Chooses which discovered repository the number belongs to. |
| `--refresh` | flag | off | Asks GitHub again for the metadata rather than using the five-minute cache. |
| `-C, --path <DIR>` | path | `.` | The repository to run against. Global. |
| `--json` | flag | off | Prints `{"message": "Opened <url>"}` instead of the sentence. Global. |
| `-h, --help` | flag | off | Prints this verb's help on stdout and exits 0. |
This is the one verb in the group with an effect outside the process, and it is
deliberately thin. It performs the same lookup every other `pr` verb performs,
takes the `url` field out of the result, and spawns the platform's opener with
that one argument:
| macOS | `open <url>` |
| Windows | `explorer <url>` |
| everything else | `xdg-open <url>` |
The choice is made at compile time from the target, not at runtime from what is
installed, so there is no fallback chain: a Linux machine without `xdg-open`
fails rather than trying `gio open` or a browser directly.
The child is spawned with stdin, stdout and stderr all attached to the null
device and is never waited on. That has two consequences worth knowing. Nothing
the browser or the opener writes can reach your terminal or your pipe, so the
sentence on stdout stays the only thing there. And the exit code only reports
whether the opener could be started: a browser that launches and then fails to
load the page, or an `xdg-open` that exits non-zero a moment later, is invisible
here. The only failure this verb can report is a missing or unexecutable opener:
```console
$ quinjet pr open 8
error: failed to hand https://github.com/pulkitxm/quinjet/pull/8 to xdg-open: No such file or directory (os error 2)
```
That exits 1. Everything else that can go wrong belongs to the lookup and is
described in [the group page](./README.md): exit 3 for a `--repo` that matches
nothing, exit 1 for a number GitHub cannot resolve.
The URL comes from GitHub rather than being constructed from the number, so it
is always the canonical one, including on a GitHub Enterprise host and for a
pull request that has since been transferred.
`--json` shape, one object with a single key. This is the standard shape for a
verb that acts rather than reads, described in
[the conventions](../conventions.md):
```json
{
"message": "Opened https://github.com/pulkitxm/quinjet/pull/8"
}
```
The message is written after the spawn succeeds, so seeing it means the opener
started, not that a page rendered.
Examples:
```bash
quinjet pr open 8
quinjet pr open 8 --repo pulkitxm/quinjet
quinjet pr open 8 --json
quinjet pr open 8 -C ~/code/quinjet
```
```console
$ quinjet pr open 8
Opened https://github.com/pulkitxm/quinjet/pull/8
```
On a headless machine, over SSH, or inside a container there is usually no
opener at all, so prefer reading the URL and doing what you like with it:
```bash
## Where to go next
- [`quinjet pr view`](./view.md) for the metadata this verb takes the URL from
- [`quinjet pr`](./README.md), the rest of this group
- [All `quinjet` commands](../README.md)