MCPcopy
hub / github.com/cli/cli / StringSliceEnumFlag

Function StringSliceEnumFlag

pkg/cmdutil/flags.go:38–46  ·  view source on GitHub ↗
(cmd *cobra.Command, p *[]string, name, shorthand string, defaultValues, options []string, usage string)

Source from the content-addressed store, hash-verified

36}
37
38func StringSliceEnumFlag(cmd *cobra.Command, p *[]string, name, shorthand string, defaultValues, options []string, usage string) *pflag.Flag {
39 *p = defaultValues
40 val := &enumMultiValue{value: p, options: options}
41 f := cmd.Flags().VarPF(val, name, shorthand, fmt.Sprintf("%s: %s", usage, formatValuesForUsageDocs(options)))
42 _ = cmd.RegisterFlagCompletionFunc(name, func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
43 return options, cobra.ShellCompDirectiveNoFileComp
44 })
45 return f
46}
47
48type gitClient interface {
49 TrackingBranchNames(context.Context, string) []string

Callers 5

NewCmdCommitsFunction · 0.92
NewCmdPrsFunction · 0.92
NewCmdIssuesFunction · 0.92
NewCmdReposFunction · 0.92
NewCmdCodeFunction · 0.92

Calls 1

formatValuesForUsageDocsFunction · 0.85

Tested by

no test coverage detected