This commit is contained in:
Caleb Brose 2022-12-12 21:21:23 +00:00
parent 8e0b4ef21b
commit 57c53e6268
4 changed files with 6 additions and 4 deletions

View file

@ -289,7 +289,9 @@ func (c codespace) running() bool {
// which instructs the user to use -R instead.
func addDeprecatedRepoShorthand(cmd *cobra.Command, target *string) error {
cmd.Flags().StringVarP(target, "repo-deprecated", "r", "", "(Deprecated) Shorthand for --repo")
cmd.PersistentFlags().MarkHidden("repo-deprecated")
if err := cmd.PersistentFlags().MarkHidden("repo-deprecated"); err != nil {
return fmt.Errorf("error marking `-r` shorthand as hidden: %w", err)
}
if err := cmd.Flags().MarkShorthandDeprecated("repo-deprecated", "use `-R` instead"); err != nil {
return fmt.Errorf("error marking `-r` shorthand as deprecated: %w", err)

View file

@ -83,7 +83,7 @@ func newCreateCmd(app *App) *cobra.Command {
createCmd.Flags().StringVarP(&opts.repo, "repo", "R", "", "repository name with owner: user/repo")
if err := addDeprecatedRepoShorthand(createCmd, &opts.repo); err != nil {
fmt.Fprint(app.io.ErrOut, "%v\n", err)
fmt.Fprintf(app.io.ErrOut, "%v\n", err)
}
createCmd.Flags().StringVarP(&opts.branch, "branch", "b", "", "repository branch")

View file

@ -68,7 +68,7 @@ func newDeleteCmd(app *App) *cobra.Command {
deleteCmd.Flags().BoolVar(&opts.deleteAll, "all", false, "Delete all codespaces")
deleteCmd.Flags().StringVarP(&opts.repoFilter, "repo", "R", "", "Delete codespaces for a `repository`")
if err := addDeprecatedRepoShorthand(deleteCmd, &opts.repoFilter); err != nil {
fmt.Fprint(app.io.ErrOut, "%v\n", err)
fmt.Fprintf(app.io.ErrOut, "%v\n", err)
}
deleteCmd.Flags().BoolVarP(&opts.skipConfirm, "force", "f", false, "Skip confirmation for codespaces that contain unsaved changes")

View file

@ -46,7 +46,7 @@ func newListCmd(app *App) *cobra.Command {
listCmd.Flags().IntVarP(&opts.limit, "limit", "L", 30, "Maximum number of codespaces to list")
listCmd.Flags().StringVarP(&opts.repo, "repo", "R", "", "Repository name with owner: user/repo")
if err := addDeprecatedRepoShorthand(listCmd, &opts.repo); err != nil {
fmt.Fprint(app.io.ErrOut, "%v\n", err)
fmt.Fprintf(app.io.ErrOut, "%v\n", err)
}
listCmd.Flags().StringVarP(&opts.orgName, "org", "o", "", "The `login` handle of the organization to list codespaces for (admin-only)")