Unverified Commit d2ec8d00 authored by bryanl's avatar bryanl
Browse files

list components in alphabetical order


Signed-off-by: default avatarbryanl <bryanliles@gmail.com>
parent 76491694
......@@ -126,6 +126,10 @@ func (cl *ComponentList) listComponentsWide(components []component.Component) er
rows = append(rows, row)
}
sort.Slice(rows, func(i, j int) bool {
return rows[i][0] < rows[j][0]
})
table := table.New(cl.out)
table.SetHeader([]string{"component", "type", "apiversion", "kind", "name"})
table.AppendBulk(rows)
......
......@@ -68,11 +68,15 @@ func TestComponentList_wide(t *testing.T) {
module := ""
output := "wide"
summary := component.Summary{ComponentName: "deployment"}
c := &cmocks.Component{}
c.On("Summarize").Return(summary, nil)
summary1 := component.Summary{ComponentName: "ingress"}
c1 := &cmocks.Component{}
c1.On("Summarize").Return(summary1, nil)
cs := []component.Component{c}
summary2 := component.Summary{ComponentName: "deployment"}
c2 := &cmocks.Component{}
c2.On("Summarize").Return(summary2, nil)
cs := []component.Component{c1, c2}
ns := &cmocks.Module{}
ns.On("Components").Return(cs, nil)
......
COMPONENT TYPE APIVERSION KIND NAME
========= ==== ========== ==== ====
deployment
ingress
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment