cli/pkg
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
..
cmd feat: add web flag for codespace list & create subcommand (#7288) 2023-04-13 10:37:16 -05:00
cmdutil Autocomplete branch flags (#6031) 2023-03-29 16:09:44 +00:00
extensions Go 1.19: fix comment formatting for moq-generated mocks 2022-12-12 16:58:25 +01:00
findsh go fmt 2021-12-02 16:12:24 +01:00
githubtemplate Replace ioutil with io and os (#5498) 2022-04-26 13:07:44 +02:00
httpmock show token scopes on auth status (#6546) 2023-01-25 16:25:00 +01:00
iostreams Rename f to run 2023-02-09 23:16:12 +00:00
jsoncolor api: avoid HTML-escaping JSON output 2022-07-25 13:10:44 +02:00
liveshare Add ability to store tokens in encrypted storage (#7043) 2023-02-28 00:04:53 +00:00
markdown Change markdown wrap limit match terminal width (#6016) 2022-09-01 07:36:25 +00:00
prompt fix linting 2022-07-27 14:15:27 -05:00
search Enable owner flag to take multiple values for searching 2023-04-12 10:37:09 +05:30
set Add GH_HOST to hosts list if it has corresponding auth token (#5087) 2022-01-29 07:37:24 +00:00
ssh Even better config support 2022-07-22 11:03:14 -05:00
surveyext feat: Fallback to notepad on Windows 2022-08-18 17:05:14 -04:00