Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 3 commits into from Dec 13, 2022

Conversation

cmbrose
Copy link
Contributor

@cmbrose cmbrose commented Dec 12, 2022

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
@cliAutomation cliAutomation added this to Needs review 🤔 in The GitHub CLI 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
Contributor 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
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

Copy link

@Gayed9 Gayed9 left a comment

Choose a reason for hiding this comment

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

Copy link

@Gayed9 Gayed9 left a comment

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
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

The GitHub CLI automation moved this from Needs review 🤔 to Needs to be merged 🎉 Dec 13, 2022
Copy link
Contributor

@vilmibm vilmibm left a comment

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
The GitHub CLI automation moved this from Needs to be merged 🎉 to Pending Release 🥚 Dec 13, 2022
@cmbrose cmbrose deleted the cmbrose/rename-repo-shorthand branch December 13, 2022 19:52
@github-actions github-actions bot moved this from Pending Release 🥚 to Done 💤 in The GitHub CLI Dec 22, 2022
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
No open projects
The GitHub CLI
  
Done 💤
Development

Successfully merging this pull request may close these issues.

None yet

5 participants