MCPcopy Create free account
hub / github.com/cli/cli / addDeprecatedRepoShorthand

Function addDeprecatedRepoShorthand

pkg/cmd/codespace/common.go:237–253  ·  view source on GitHub ↗

addDeprecatedRepoShorthand adds a -r parameter (deprecated shorthand for --repo) which instructs the user to use -R instead.

(cmd *cobra.Command, target *string)

Source from the content-addressed store, hash-verified

235// addDeprecatedRepoShorthand adds a -r parameter (deprecated shorthand for --repo)
236// which instructs the user to use -R instead.
237func addDeprecatedRepoShorthand(cmd *cobra.Command, target *string) error {
238 cmd.Flags().StringVarP(target, "repo-deprecated", "r", "", "(Deprecated) Shorthand for --repo")
239
240 if err := cmd.Flags().MarkHidden("repo-deprecated"); err != nil {
241 return fmt.Errorf("error marking `-r` shorthand as hidden: %w", err)
242 }
243
244 if err := cmd.Flags().MarkShorthandDeprecated("repo-deprecated", "use `-R` instead"); err != nil {
245 return fmt.Errorf("error marking `-r` shorthand as deprecated: %w", err)
246 }
247
248 if cmd.Flag("codespace") != nil {
249 cmd.MarkFlagsMutuallyExclusive("codespace", "repo-deprecated")
250 }
251
252 return nil
253}
254
255// validateNWO returns an error if nwo is not a valid "owner/repo" repository reference.
256func validateNWO(nwo string) error {

Callers 3

newDeleteCmdFunction · 0.85
newCreateCmdFunction · 0.85
newListCmdFunction · 0.85

Calls 1

ErrorfMethod · 0.65

Tested by

no test coverage detected