Request: `codespace start` and/or `codespace restart`
- Dominant language
- Go
- Stars
- 46.3k
- Forks
- 9k
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 89
Description
### Describe the feature or problem you’d like to solve
I’m just trying out Codespaces for the first time this morning, and in trying to build my mental model of how it works, I’ve started with the CLI, as opposed to the Web GUI or the VS Code integration.
This is mostly going quite well. Kudos!
One thing I find a bit confusing is trying to understand the possible states that a Codespace can be in.
When I run `gh cs --help` these are the commands that are listed that seem to be related to Codespace lifecycles:
```
create: Create a codespace
delete: Delete a codespace
stop: Stop a running codespace
```
The way I understand this is: OK, a Codespace can exist, or be deleted. It can be stopped. If it can be stopped, i.e. put into a stopped state, then it also has a started or running state. It seems pretty clear that `create` _also_ starts/runs the Codespace — which is fine! Makes sense, even. And `stop` seems pretty straightforward.
What I’m finding confusing is: how do I re-start a Codespace that I’ve stopped? I don’t see a command for this. I’m guessing maybe it’s automatic when I run `code` or `cp` or `ssh` etc — maybe any command that attempts to connect to a stopped Codespace will automatically restart it. Which again, is fine, and probably makes sense. But personally I’d prefer to manage the state of my Codespace directly and explicitly. So I’d find it helpful if a new subcommand like `start` or `restart` were added.
### Proposed solution
A new subcommand named `start` or `restart` would enable users to directly and explicitly restart a Codespace that they’d stopped, or had stopped automatically.
This would give users more control and agency, and also help them build their mental model of how Codespaces work, by interacting with `gh`, viewing the list of subcommands, etc. (I think maybe a UX term for that is “affordance”? Not sure, but my fuzzy understanding is that mere awareness of the capabilities of a tool helps a user learn that tool.)
### Additional context
I’m using gh version 2.2.0 (2021-10-25).
Full output of `gh cs --help`
```shell
$ gh cs --help
Connect to and manage your codespaces
USAGE
gh codespace [flags]
CORE COMMANDS
code: Open a codespace in Visual Studio Code
cp: Copy files between local and remote file systems
create: Create a codespace
delete: Delete a codespace
list: List your codespaces
logs: Access codespace logs
ports: List ports in a codespace
ssh: SSH into a codespace
stop: Stop a running codespace
INHERITED FLAGS
--help Show help for command
LEARN MORE
Use 'gh --help' for more information about a command.
Read the manual at https://cli.github.com/manual
```
Contributor guide
Assessment
This issue has not been assessed yet.