Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kubectl get print filter info use verbose #34537

Merged
merged 1 commit into from
Oct 19, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 6 additions & 6 deletions pkg/kubectl/cmd/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ func RunGet(f *cmdutil.Factory, out io.Writer, errOut io.Writer, cmd *cobra.Comm
return fmt.Errorf("unable to output the provided object: %v", err)
}
filteredResourceCount++
cmdutil.PrintFilterCount(filteredResourceCount, mapping.Resource, errOut, filterOpts)
cmdutil.PrintFilterCount(filteredResourceCount, mapping.Resource, filterOpts)
}

// print watched changes
Expand All @@ -272,7 +272,7 @@ func RunGet(f *cmdutil.Factory, out io.Writer, errOut io.Writer, cmd *cobra.Comm
return false, err
}
filteredResourceCount++
cmdutil.PrintFilterCount(filteredResourceCount, mapping.Resource, errOut, filterOpts)
cmdutil.PrintFilterCount(filteredResourceCount, mapping.Resource, filterOpts)
return false, nil
})
return err
Expand Down Expand Up @@ -347,7 +347,7 @@ func RunGet(f *cmdutil.Factory, out io.Writer, errOut io.Writer, cmd *cobra.Comm
errs = append(errs, err)
}

cmdutil.PrintFilterCount(filteredResourceCount, res, errOut, filterOpts)
cmdutil.PrintFilterCount(filteredResourceCount, res, filterOpts)
return utilerrors.Reduce(utilerrors.Flatten(utilerrors.NewAggregate(errs)))
}

Expand All @@ -362,7 +362,7 @@ func RunGet(f *cmdutil.Factory, out io.Writer, errOut io.Writer, cmd *cobra.Comm
filteredResourceCount++
}

cmdutil.PrintFilterCount(filteredResourceCount, res, errOut, filterOpts)
cmdutil.PrintFilterCount(filteredResourceCount, res, filterOpts)
return utilerrors.Reduce(utilerrors.Flatten(utilerrors.NewAggregate(errs)))
}

Expand Down Expand Up @@ -430,7 +430,7 @@ func RunGet(f *cmdutil.Factory, out io.Writer, errOut io.Writer, cmd *cobra.Comm
if printer == nil || lastMapping == nil || mapping == nil || mapping.Resource != lastMapping.Resource {
if printer != nil {
w.Flush()
cmdutil.PrintFilterCount(filteredResourceCount, lastMapping.Resource, errOut, filterOpts)
cmdutil.PrintFilterCount(filteredResourceCount, lastMapping.Resource, filterOpts)
}
printer, err = f.PrinterForMapping(cmd, mapping, allNamespaces)
if err != nil {
Expand Down Expand Up @@ -488,7 +488,7 @@ func RunGet(f *cmdutil.Factory, out io.Writer, errOut io.Writer, cmd *cobra.Comm
}
w.Flush()
if printer != nil && lastMapping != nil {
cmdutil.PrintFilterCount(filteredResourceCount, lastMapping.Resource, errOut, filterOpts)
cmdutil.PrintFilterCount(filteredResourceCount, lastMapping.Resource, filterOpts)
}
return utilerrors.NewAggregate(allErrs)
}
6 changes: 2 additions & 4 deletions pkg/kubectl/cmd/util/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -698,12 +698,10 @@ func FilterResourceList(obj runtime.Object, filterFuncs kubectl.Filters, filterO
return filterCount, list, nil
}

func PrintFilterCount(hiddenObjNum int, resource string, out io.Writer, options *kubectl.PrintOptions) error {
func PrintFilterCount(hiddenObjNum int, resource string, options *kubectl.PrintOptions) {
if !options.NoHeaders && !options.ShowAll && hiddenObjNum > 0 {
_, err := fmt.Fprintf(out, " info: %d completed object(s) was(were) not shown in %s list. Pass --show-all to see all objects.\n\n", hiddenObjNum, resource)
return err
glog.V(2).Infof(" info: %d completed object(s) was(were) not shown in %s list. Pass --show-all to see all objects.\n\n", hiddenObjNum, resource)
}
return nil
}

// ObjectListToVersionedObject receives a list of api objects and a group version
Expand Down