Skip to content

Commit af49248

Browse files
cli: lib list
1 parent 6f2ee59 commit af49248

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

Diff for: internal/cli/lib/list.go

+8-8
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ func List(instance *rpc.Instance, args []string, all bool, updatable bool) {
6767
}
6868
feedback.PrintResult(installedResult{
6969
onlyUpdates: updatable,
70-
installedLibs: installedLibsResult,
70+
InstalledLibs: installedLibsResult,
7171
})
7272
logrus.Info("Done")
7373
}
@@ -118,24 +118,24 @@ func GetList(
118118
// output from this command requires special formatting, let's create a dedicated
119119
// feedback.Result implementation
120120
type installedResult struct {
121+
InstalledLibs []*result.InstalledLibrary `json:"installed_libraries"`
121122
onlyUpdates bool
122-
installedLibs []*result.InstalledLibrary
123123
}
124124

125125
func (ir installedResult) Data() interface{} {
126-
return ir.installedLibs
126+
return ir
127127
}
128128

129129
func (ir installedResult) String() string {
130-
if len(ir.installedLibs) == 0 {
130+
if len(ir.InstalledLibs) == 0 {
131131
if ir.onlyUpdates {
132132
return tr("No libraries update is available.")
133133
}
134134
return tr("No libraries installed.")
135135
}
136-
sort.Slice(ir.installedLibs, func(i, j int) bool {
137-
return strings.ToLower(ir.installedLibs[i].Library.Name) < strings.ToLower(ir.installedLibs[j].Library.Name) ||
138-
strings.ToLower(ir.installedLibs[i].Library.ContainerPlatform) < strings.ToLower(ir.installedLibs[j].Library.ContainerPlatform)
136+
sort.Slice(ir.InstalledLibs, func(i, j int) bool {
137+
return strings.ToLower(ir.InstalledLibs[i].Library.Name) < strings.ToLower(ir.InstalledLibs[j].Library.Name) ||
138+
strings.ToLower(ir.InstalledLibs[i].Library.ContainerPlatform) < strings.ToLower(ir.InstalledLibs[j].Library.ContainerPlatform)
139139
})
140140

141141
t := table.New()
@@ -145,7 +145,7 @@ func (ir installedResult) String() string {
145145
t.SetColumnWidthMode(4, table.Average)
146146

147147
lastName := ""
148-
for _, libMeta := range ir.installedLibs {
148+
for _, libMeta := range ir.InstalledLibs {
149149
lib := libMeta.Library
150150
name := lib.Name
151151
if name == lastName {

0 commit comments

Comments
 (0)