Skip to content

Codespaces: Use -R for --repo shorthand and deprecate -r - #6725

Merged
cmbrose merged 3 commits into
trunkfrom
cmbrose/rename-repo-shorthand
Dec 13, 2022
Merged

cmbrose merged 3 commits into
trunkfrom
cmbrose/rename-repo-shorthand

Conversation

@cmbrose

@cmbrose cmbrose commented Dec 12, 2022 •

Copy link
Copy Markdown
Member

Related: #6548

The codespaces commands use -r as shorthand for --repo which is inconsistent with other commands which use -R instead. This change updates existing usage of -r to be -R and marks usage of -r as hidden and deprecated.

Examples:

-R exists and -r is hidden:
image

-R works like --repo:
image

-r still works, but warns about deprecation:
image

Note that part of the motivation to make this change is to make #6548 more friendly - it removes a collision of -r in gh cs cp for that change.

@cmbrose
cmbrose requested a review from a team as a code owner December 12, 2022 19:51
@cliAutomation cliAutomation added the external pull request originating outside of the CLI core team label Dec 12, 2022

// addDeprecatedRepoShorthand adds a -r parameter (deprecated shorthand for --repo)
// which instructs the user to use -R instead.
func addDeprecatedRepoShorthand(cmd *cobra.Command, target *string) error {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there are any suggestions for how to make this cleaner, I would love to improve this 😄 I couldn't figure out a way to mark -r as deprecated and still have -R added

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes sense to me

@Gayed9 Gayed9 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Gayed9 Gayed9 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pkg/cmd/codespace/common.go


// addDeprecatedRepoShorthand adds a -r parameter (deprecated shorthand for --repo)
// which instructs the user to use -R instead.
func addDeprecatedRepoShorthand(cmd *cobra.Command, target *string) error {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes sense to me

@vilmibm vilmibm left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a fair approach given what tools Cobra provides. Thanks for doing this!

@cmbrose
cmbrose merged commit 6f1d149 into trunk Dec 13, 2022
@cmbrose
cmbrose deleted the cmbrose/rename-repo-shorthand branch December 13, 2022 19:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

external pull request originating outside of the CLI core team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants