- Currently the flow to delete a single Codespace is `gh cs list`, copy
and paste the Codespace name onto the end of `gh cs delete`.
- This improves consistency with other commands by letting the user
choose which Codespace they want to delete, interactively. A Codespace
name on the command-line still works too.
Replace the implementation that relied on symlinks with the one that
create regular files that act like symlinks: they contain a reference to
the local directory where to find the extension.
- This adds a `-c`, `--codespace` parameter to `ghcs ssh` to allow for
non-interactively specifying a Codespace to SSH into, for instance if
a user has recently done `ghcs list` and already knows which Codespace
they want to access. Without a value for the `-c` parameter, the
interactive prompt appears as usual.
- I ran `--help` on `ghcs code` and saw `ghcs code` and that was it,
which was surprising. I expected a description.
- Here's a fix for all of the commands thus far to give them longer
descriptions.
- I've only done "short" descriptions in Cobra terms, and removed the
"long" descriptions as they seemed like they needed to be
unnecessarily verbose.
Before:
```
❯ ghcs --help
Codespaces
Usage:
ghcs [command]
Available Commands:
code code
create Create
delete delete
help Help about any command
list list
ports ports
ssh ssh
Flags:
-h, --help help for ghcs
-v, --version version for ghcs
Use "ghcs [command] --help" for more information about a command.
❯ ghcs ssh --help
ssh
Usage:
ghcs ssh [flags]
Flags:
-h, --help help for ssh
--profile string SSH Profile
--server-port int SSH Server Port
```
After:
```
❯ ./ghcs --help
Codespaces
Usage:
ghcs [command]
Available Commands:
code Open a GitHub Codespace in VSCode.
create Create a GitHub Codespace.
delete Delete a GitHub Codespace.
help Help about any command
list List GitHub Codespaces you have on your account.
ports Forward ports from a GitHub Codespace.
ssh SSH into a GitHub Codespace, for use with running tests/editing in vim, etc.
Flags:
-h, --help help for ghcs
-v, --version version for ghcs
Use "ghcs [command] --help" for more information about a command.
❯ ./ghcs ssh --help
SSH into a GitHub Codespace, for use with running tests/editing in vim, etc.
Usage:
ghcs ssh [flags]
Flags:
-h, --help help for ssh
--profile string SSH Profile
--server-port int SSH Server Port
```
- This is built into Cobra the argument parser. Now `ghcs --version`
exists.
- When we prepare to bump the version, we need to remember to update
this value else the Homebrew formula, GitHub releases and the `ghcs
--version` output will be mismatched.
- Fixes https://github.com/github/ghcs/issues/16.
- I have my GitHub API token in my environment as
`HOMEBREW_GITHUB_API_TOKEN`, so with things that need `GITHUB_TOKEN` I
have to remember to `export GITHUB_TOKEN=$HOMEBREW_GITHUB_API_TOKEN`.
- I didn't for this tool, and got this unfriendly error message:
```
❯ ghcs list
Error: error getting user: Bad credentials
Usage:
ghcs list [flags]
Flags:
-h, --help help for list
error getting user: Bad credentials
```
- This moves the "do you have a `GITHUB_TOKEN`" question to the very
beginning (no guarantees about org SSO access, just a string that
exists), erroring out with a nice message if users don't have that
envvar set:
```
issyl0 in cetus in ~/repos/github/ghcs/cmd/ghcs on gracefully-fail-if-token-envvar-unset
❯ ./ghcs list
The GITHUB_TOKEN environment variable is required. Create a Personal Access Token with org SSO access at https://github.com/settings/tokens/new.
issyl0 in cetus in ~/repos/github/ghcs/cmd/ghcs on gracefully-fail-if-token-envvar-unset
❯ export GITHUB_TOKEN=$HOMEBREW_GITHUB_API_TOKEN
❯ ./ghcs list
+--------------------------------+--------------------+------------------------------------+----------+---------------------------+
| NAME | REPOSITORY | BRANCH | STATE | CREATED AT |
+--------------------------------+--------------------+------------------------------------+----------+---------------------------+
| issyl0-github-cat-ggrpj5fvwvr | github/cat | dependabot/bundler/graphql-1.12.13 | Shutdown | 2021-07-13T12:36:53+01:00 |
+--------------------------------+--------------------+------------------------------------+----------+---------------------------+
```