MCPcopy Create free account
hub / github.com/auth0/auth0-cli / Pick

Method Pick

internal/cli/arguments.go:39–63  ·  view source on GitHub ↗
(cmd *cobra.Command, result *string, fn pickerOptionsFunc)

Source from the content-addressed store, hash-verified

37type pickerOptionsFunc func(ctx context.Context) (pickerOptions, error)
38
39func (a *Argument) Pick(cmd *cobra.Command, result *string, fn pickerOptionsFunc) error {
40 if !canPrompt(cmd) {
41 return fmt.Errorf("missing a required argument: %s", a.GetName())
42 }
43
44 var opts pickerOptions
45 err := ansi.Waiting(func() error {
46 var err error
47 opts, err = fn(cmd.Context())
48 return err
49 })
50
51 if err != nil {
52 return err
53 }
54
55 defaultLabel := opts.defaultLabel()
56 var val string
57 if err := _select(a, &val, opts.labels(), &defaultLabel, false); err != nil {
58 return err
59 }
60
61 *result = opts.getValue(val)
62 return nil
63}
64
65func (a *Argument) PickMany(cmd *cobra.Command, result *[]string, fn pickerOptionsFunc) error {
66 if !canPrompt(cmd) {

Callers 1

resolveAPIAppLinkFunction · 0.95

Calls 8

GetNameMethod · 0.95
defaultLabelMethod · 0.95
labelsMethod · 0.95
getValueMethod · 0.95
WaitingFunction · 0.92
canPromptFunction · 0.85
_selectFunction · 0.85
ErrorfMethod · 0.80

Tested by

no test coverage detected