mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-05 23:47:50 +00:00
Don't print the "filtered" message on generic output
Unify the various output displays and make them simpler. Don't write to glog, but only output the info when `-v 2` to stderr.
This commit is contained in:
@@ -698,9 +698,26 @@ func FilterResourceList(obj runtime.Object, filterFuncs kubectl.Filters, filterO
|
||||
return filterCount, list, nil
|
||||
}
|
||||
|
||||
func PrintFilterCount(hiddenObjNum int, resource string, options *printers.PrintOptions) {
|
||||
if !options.NoHeaders && !options.ShowAll && hiddenObjNum > 0 {
|
||||
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)
|
||||
// PrintFilterCount displays informational messages based on the number of resources found, hidden, or
|
||||
// config flags shown.
|
||||
func PrintFilterCount(out io.Writer, found, hidden, errors int, resource string, options *printers.PrintOptions, ignoreNotFound bool) {
|
||||
switch {
|
||||
case errors > 0 || ignoreNotFound:
|
||||
// print nothing
|
||||
case found <= hidden:
|
||||
if found == 0 {
|
||||
fmt.Fprintln(out, "No resources found.")
|
||||
} else {
|
||||
fmt.Fprintln(out, "No resources found, use --show-all to see completed objects.")
|
||||
}
|
||||
case hidden > 0 && !options.ShowAll && !options.NoHeaders:
|
||||
if glog.V(2) {
|
||||
if hidden > 1 {
|
||||
fmt.Fprintf(out, "info: %d objects not shown, use --show-all to see completed objects.\n", hidden)
|
||||
} else {
|
||||
fmt.Fprintf(out, "info: 1 object not shown, use --show-all to see completed objects.\n")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user