Commit graph

407 commits

Author SHA1 Message Date
Alexander Seiler
218f29f296
Correct some typos 2023-04-21 03:51:31 +02:00
Caleb Brose
09e86d0ebf
Fix gh cs ports requiring sudo for privileged port numbers (#7326) 2023-04-19 07:00:44 -05:00
John Keech
4b5a9032fe
Clarify how SSH keys are selected (#7325)
Fixes: https://github.com/orgs/community/discussions/52556

Update the help text for `gh codespace ssh` to provide more details about how SSH keys are selected.
2023-04-17 10:19:03 -07:00
Navaneethan
c0855a3e61
Fix typo in cs stop command: Stoppping -> Stopping (#7318) 2023-04-14 14:08:42 -05:00
doaortu
83322104b7
feat: add web flag for codespace list & create subcommand (#7288)
* feat: add web flag to cs list subcommand

web flag only works with repo flag, because,
currently there only param for listing with repo_id

* feat: add web flag to cs crate subcommand

web flag used for creating codespace through web UI instead of terminal.
web flag cannot be used with display-name, idle-timeout,
or retention retention-period
because there's no option for that in the Web UI

* refactor: extract mutual excusive logic to PreRunE

- changed web flag mutual exclusive logic, using cmdutil
- extract that logic to PreRunE clause in createCmd
- move web flag up to make it close to PreRunE clause (for clarity)
- add new param to newCreateCmd fn to facilitate test logic
- apply new newCreateCmd fn to root.go

* fix: clarify flag desc and error message

- remove 'yet' from error messages that can cause misunderstanding
- clarify list web flag can only be used with repo flag

* fix: skip machine check when we use web flag ...
(..and no machine flag provided)

+ add test for this new case
+ adjust related test cases for this new change.

* refactor: move flag check logic to PreRunE

why: err on PreRunE or RunE will also print help if error happened

+ move web, repo, org, user mutual exclusive logic to PreRunE clause
+ move repo, org, user mutual exclusive logic to PreRunE
+ move limit check flag to PreRunE
+ modify newListCmd fn to facilitate test logic
+ apply new newListCmd to root.go
+ add test cases to check PreRunE clause
- remove mutual exclusive test cases from Test_AppList

* refactor: remove the opts equality checks

* fix: mutually exclusive misfires
because of wrong logic

+ refine test case too

* cleanup:removing useWeb check in fn getMachineName

because it's no longer needed

+ remove redundant test-case

* refactor: remove redundant ifs

* refactor: clarify test name

* re-clarify web flag desc in list.go

* refactor: break long lines, use more idiomatic err

* add test case for nonexistent/wrong machine
2023-04-13 10:37:16 -05:00
Caleb Brose
27a3fcc807 Fix invoker immediately closing 2023-04-05 19:33:50 -05:00
Mislav Marohnić
1933fc2f69
codespace ssh: fix "connection reset by peer" 2023-03-09 15:14:39 +01:00
JP Ungaretti
0673dcccb1 Fix delete tests 2023-03-07 19:29:44 +00:00
JP Ungaretti
39a1dc90af Match return style 2023-03-07 19:05:49 +00:00
JP Ungaretti
c347737ace Fix build errors 2023-03-07 18:47:27 +00:00
JP Ungaretti
5a7f779cf7 Merge branch 'trunk' into jungaretti/fix-jupyter-spinner 2023-03-07 18:43:34 +00:00
Caleb Brose
c9992b41a2
Always open new vscode window in gh cs code (#7092)
* Open new vscode window

* Tests
2023-03-06 22:50:43 +00:00
Caleb Brose
57c73e8239
Add --repo filter to more gh codespaces commands (#6669)
* 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
2023-02-22 17:16:36 -06:00
JP Ungaretti
6a150d57e0 Adopt in delete.go 2023-02-09 23:21:41 +00:00
JP Ungaretti
a388358348 Merge branch 'trunk' into jungaretti/fix-jupyter-spinner 2023-02-09 23:18:22 +00:00
JP Ungaretti
1b88915a4d Rename f to run 2023-02-09 23:16:12 +00:00
JP Ungaretti
a848cd1bd0 Adopt in stop.go 2023-02-09 23:13:44 +00:00
JP Ungaretti
bc789b2787 Adopt in ssh.go 2023-02-09 22:53:48 +00:00
JP Ungaretti
970088a7af Adopt in ports.go 2023-02-09 22:52:04 +00:00
JP Ungaretti
f77eb5f932 Adopt in list.go 2023-02-09 22:48:29 +00:00
JP Ungaretti
123380ac83 Adopt in edit.go 2023-02-09 22:36:38 +00:00
JP Ungaretti
38397f11be Adopt in delete.go 2023-02-09 22:30:57 +00:00
JP Ungaretti
d815d54bd2 Adopt in create.go 2023-02-09 22:24:09 +00:00
JP Ungaretti
43783a33a2 Move helper to iostreams 2023-02-09 22:23:58 +00:00
Robin Neatherway
78fb90956c
Teach gh cs create to use current repo as default (#6596)
Co-authored-by: Mislav Marohnić <mislav@github.com>
2023-02-07 20:05:38 +00:00
Luan Vieira
d4c9890c5a
Default to authenticated user on codespace delete (#6944)
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>
2023-02-07 20:46:08 +01:00
Caleb Brose
90ae71b2ba
Merge pull request #6888 from cli/cmbrose/pf-half-close
Half close port forwarding connections to fix hangs
2023-01-23 14:26:19 -06:00
Ryan Caldwell
71ec2c4e23
Codespaces create: Fix missing billable owner notice for individuals (#6891) 2023-01-23 13:15:44 +01:00
Caleb Brose
2b95cbc5a6 Close port forward writer on reader 2023-01-19 20:22:24 -06:00
JP Ungaretti
5879923b4f Use progress runner a few times 2023-01-12 22:56:33 +00:00
JP Ungaretti
216d3bf912 Add generic progress runner 2023-01-12 22:56:19 +00:00
JP Ungaretti
efe57991b0 Fix spinner on error 2023-01-12 22:36:27 +00:00
David Gardiner
ce6b7d8762 Start SSH server with gRPC 2023-01-10 11:59:56 -08:00
David Gardiner
839378d5cb
Merge pull request #6657 from dmgardiner25/codespaces-rpc-invoker
Create centralized Codespaces RPC invoker
2023-01-06 12:58:44 -08:00
David Gardiner
814fcf8c74 Remove unused token field 2023-01-06 09:56:16 -08:00
John Keech
791c7db632
Fix typo in has_uncommitted_changes for codespaces (#6812)
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.
2023-01-05 22:02:32 +00:00
David Gardiner
000a84d49b Address comments 2023-01-04 15:33:33 -08:00
David Gardiner
731ba682f2 Create Invoker object 2023-01-04 14:41:25 -08:00
David Gardiner
1e75a74d18 Create centralized Codespaces RPC invoker 2023-01-04 14:41:25 -08:00
Des Preston
4ade907ae8
Allow setting codespace display name during create (#6739)
Co-authored-by: Mislav Marohnić <mislav@github.com>
2022-12-19 17:10:34 +01:00
Caleb Brose
56006eefa6 Flags instead of PersistentFlag 2022-12-13 01:20:49 +00:00
Caleb Brose
57c53e6268 linter 2022-12-12 21:21:23 +00:00
Caleb Brose
8e0b4ef21b Use -R for --repo shorthand and deprecate -r 2022-12-12 19:44:59 +00:00
Mislav Marohnić
e4f5545e86
Go 1.19: fix comment formatting for moq-generated mocks 2022-12-12 16:58:25 +01:00
Sam Coe
6dbe7e6342
Linter fixes (#6722)
Co-authored-by: Mislav Marohnić <mislav@github.com>
2022-12-12 15:27:32 +00:00
Jake Shorty
1cb62b182c Use new domain for forwarded ports 2022-12-08 18:36:26 +00:00
JP Ungaretti
925edf3892 Add long description 2022-11-01 22:35:39 +00:00
JP Ungaretti
a29820ebe3 Use incremental rebuild by default 2022-11-01 21:00:14 +00:00
Ashwin Jeyaseelan
a756ffb1e8
Fix Codespace Creation Devcontainer bug (#6389) 2022-10-18 11:11:28 +03:00
Mislav Marohnić
3fe5026d39
Migrate to tableprinter from go-gh (#6346) 2022-10-17 15:15:39 +02:00