Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Ijaz Ahmad
ksonnet
Commits
d2ec8d00
Unverified
Commit
d2ec8d00
authored
May 07, 2018
by
bryanl
Browse files
list components in alphabetical order
Signed-off-by:
bryanl
<
bryanliles@gmail.com
>
parent
76491694
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
4 deletions
+13
-4
pkg/actions/component_list.go
pkg/actions/component_list.go
+4
-0
pkg/actions/component_list_test.go
pkg/actions/component_list_test.go
+8
-4
pkg/actions/testdata/component/list/wide.txt
pkg/actions/testdata/component/list/wide.txt
+1
-0
No files found.
pkg/actions/component_list.go
View file @
d2ec8d00
...
...
@@ -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
)
...
...
pkg/actions/component_list_test.go
View file @
d2ec8d00
...
...
@@ -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
)
summary
1
:=
component
.
Summary
{
ComponentName
:
"
ingress
"
}
c
1
:=
&
cmocks
.
Component
{}
c
1
.
On
(
"Summarize"
)
.
Return
(
summary
1
,
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
)
...
...
pkg/actions/testdata/component/list/wide.txt
View file @
d2ec8d00
COMPONENT TYPE APIVERSION KIND NAME
========= ==== ========== ==== ====
deployment
ingress
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment