in pkg/internal/converter/options.go [77:92]
func completeContexts(o *Options) func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
return func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
clientConfig := o.configFlags.ToRawKubeConfigLoader()
config, err := clientConfig.RawConfig()
if err != nil {
cobra.CompDebugln(fmt.Sprintf("unable to load kubeconfig: %s", err), false)
}
contexts := make([]string, 0, len(config.Contexts))
for name := range config.Contexts {
contexts = append(contexts, name)
}
return contexts, cobra.ShellCompDirectiveNoFileComp
}
}