add resource prefix to multiple items w/ same kind

This patch ensures that a resource prefix is added to multiple items of
the same kind, when using `oc get all`. Before, a prefix was added only
when a single item was returned on `oc get all`, but ignored if only a
single resource kind existed but multiple items for that kind were
returned.
This commit is contained in:
juanvallejo
2016-11-29 12:25:10 -05:00
parent 7d611fe32b
commit 3484c6f676
4 changed files with 89 additions and 15 deletions

View File

@@ -629,13 +629,9 @@ func MaybeConvertObject(obj runtime.Object, gv schema.GroupVersion, converter ru
// with multiple resource kinds, in which case it will
// return true, indicating resource kind will be
// included as part of printer output
func MustPrintWithKinds(objs []runtime.Object, infos []*resource.Info, sorter *kubectl.RuntimeSort, printAll bool) bool {
func MustPrintWithKinds(objs []runtime.Object, infos []*resource.Info, sorter *kubectl.RuntimeSort) bool {
var lastMap *meta.RESTMapping
if len(infos) == 1 && printAll {
return true
}
for ix := range objs {
var mapping *meta.RESTMapping
if sorter != nil {