fix(comp): Update based on review comments

Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>
pull/7323/head
Marc Khouzam 5 years ago
parent a8369db802
commit 77b900106f

@ -54,10 +54,9 @@ func addChartPathOptionsFlags(f *pflag.FlagSet, c *action.ChartPathOptions) {
// value to the given format pointer // value to the given format pointer
func bindOutputFlag(cmd *cobra.Command, varRef *output.Format) { func bindOutputFlag(cmd *cobra.Command, varRef *output.Format) {
f := cmd.Flags() f := cmd.Flags()
f.VarP(newOutputValue(output.Table, varRef), outputFlag, "o", flag := f.VarPF(newOutputValue(output.Table, varRef), outputFlag, "o",
fmt.Sprintf("prints the output in the specified format. Allowed values: %s", strings.Join(output.Formats(), ", "))) fmt.Sprintf("prints the output in the specified format. Allowed values: %s", strings.Join(output.Formats(), ", ")))
flag := f.Lookup(outputFlag)
completion.RegisterFlagCompletionFunc(flag, func(cmd *cobra.Command, args []string, toComplete string) ([]string, completion.BashCompDirective) { completion.RegisterFlagCompletionFunc(flag, func(cmd *cobra.Command, args []string, toComplete string) ([]string, completion.BashCompDirective) {
var formatNames []string var formatNames []string
for _, format := range output.Formats() { for _, format := range output.Formats() {

@ -117,7 +117,6 @@ func newRootCmd(actionConfig *action.Configuration, out io.Writer, args []string
completion.CompDebugln(fmt.Sprintf("About to call kube client for namespaces with timeout of: %d", to)) completion.CompDebugln(fmt.Sprintf("About to call kube client for namespaces with timeout of: %d", to))
nsNames := []string{} nsNames := []string{}
// TODO can we request only the namespace with request.prefix?
if namespaces, err := client.CoreV1().Namespaces().List(metav1.ListOptions{TimeoutSeconds: &to}); err == nil { if namespaces, err := client.CoreV1().Namespaces().List(metav1.ListOptions{TimeoutSeconds: &to}); err == nil {
for _, ns := range namespaces.Items { for _, ns := range namespaces.Items {
if strings.HasPrefix(ns.Name, toComplete) { if strings.HasPrefix(ns.Name, toComplete) {

Loading…
Cancel
Save