MCPcopy
hub / github.com/cli/cli / addDeprecatedRepoShorthand

Function addDeprecatedRepoShorthand

pkg/cmd/codespace/common.go:236–252  ·  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

234// addDeprecatedRepoShorthand adds a -r parameter (deprecated shorthand for --repo)
235// which instructs the user to use -R instead.
236func addDeprecatedRepoShorthand(cmd *cobra.Command, target *string) error {
237 cmd.Flags().StringVarP(target, "repo-deprecated", "r", "", "(Deprecated) Shorthand for --repo")
238
239 if err := cmd.Flags().MarkHidden("repo-deprecated"); err != nil {
240 return fmt.Errorf("error marking `-r` shorthand as hidden: %w", err)
241 }
242
243 if err := cmd.Flags().MarkShorthandDeprecated("repo-deprecated", "use `-R` instead"); err != nil {
244 return fmt.Errorf("error marking `-r` shorthand as deprecated: %w", err)
245 }
246
247 if cmd.Flag("codespace") != nil {
248 cmd.MarkFlagsMutuallyExclusive("codespace", "repo-deprecated")
249 }
250
251 return nil
252}
253
254// filterCodespacesByRepoOwner filters a list of codespaces by the owner of the repository.
255func filterCodespacesByRepoOwner(codespaces []*api.Codespace, repoOwner string) []*api.Codespace {

Callers 3

newDeleteCmdFunction · 0.85
newCreateCmdFunction · 0.85
newListCmdFunction · 0.85

Calls 1

ErrorfMethod · 0.65

Tested by

no test coverage detected