( f *Factory, )
| 10 | ) |
| 11 | |
| 12 | func 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 | |
| 31 | func StringCompletionFunc( |
| 32 | allowedMap map[string]string, |
no test coverage detected