* Use the host name from the logged in server for codespace commands
* Fix existing tests
* Add tests for server url configuration
* Rename defaultApiUrl to defaultAPIURL and comment cleanup
* Switch to t.Setenv in codespaces api tests
* Switch to t.Setenv in other tests
* Support custom server in web flows for list and create
* Rename GetServerURL() to ServerURL()
* Add --repo flag to commands
* Example of using common args
* Add -r to stop
* Add validation to the add helper
* Skip prompt for single option
* Migrate (mostly) everything to addGetOrChooseCodespaceCommandArgs
* Fix typo in logsCmd
* Use R instead of r
* Update a couple -r usages
* Refactor to codespace_selector
* Clean up selector, apply it in a couple examples
* Use apiClient instead in constructor
* Restore addDeprecatedRepoShorthand
* Finish implementing the commands
* Update existing tests to use the selector
* Add tests for selector
* linter
* Catch case where there's no conflict
* Make the flag persistent for ports
* Add support to stop
When a username option is not provided for the `gh codespace delete`
command, we will use the authenticated user's login as the default to
avoid deleting anyone else's codespace by mistake.
Prior to this change, running `gh codespace delete --org MYORG --all`
would fetch all of the codespacese associated with the org regardless of
user and then only delete the ones associated with the authenticated
user, which would lead to 404 errors when MYORG had codespaces owned by
members other than the authenticated member.
Co-authored-by: Victoria Dye <vdye@github.com>
Co-authored-by: Lessley Dennington <ldennington@github.com>
The REST API for codespaces returns the following schema:
```
"git_status": {
"ahead": 0,
"behind": 0,
"has_unpushed_changes": false,
"has_uncommitted_changes": false,
"ref": "main"
},
```
The CLI was looking for `has_uncommited_changes` in the response instead of `has_uncommitted_changes`, leading to it always reporting a `false` value which could be different than the API response.
This doesn't change anything about how it's formatted, but extracts a
new function formatCodespacesForSelect so we can test and see how it
treats the different combinations of codespaces.
Co-authored-by: Mislav Marohnić <mislav@github.com>