MCPcopy Create free account
hub / github.com/algolia/cli / ConfiguredProfilesCompletionFunc

Function ConfiguredProfilesCompletionFunc

pkg/cmdutil/flags_completion.go:12–29  ·  view source on GitHub ↗
(
	f *Factory,
)

Source from the content-addressed store, hash-verified

10)
11
12func ConfiguredProfilesCompletionFunc(
13 f *Factory,
14) func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
15 return func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
16 profiles := f.Config.ConfiguredProfiles()
17 completions := make([]string, 0, len(profiles))
18
19 // We want to show the profile name and the Application ID as the description.
20 // https://github.com/spf13/cobra/blob/master/shell_completions.md#descriptions-for-completions
21 for _, profile := range profiles {
22 completions = append(
23 completions,
24 fmt.Sprintf("%s\t%s", profile.Name, profile.ApplicationID),
25 )
26 }
27 return completions, cobra.ShellCompDirectiveNoFileComp
28 }
29}
30
31func StringCompletionFunc(
32 allowedMap map[string]string,

Callers 3

NewRemoveCmdFunction · 0.92
NewSetDefaultCmdFunction · 0.92
NewRootCmdFunction · 0.92

Calls 1

ConfiguredProfilesMethod · 0.65

Tested by

no test coverage detected