@@ -24,6 +24,7 @@ import (
24
24
25
25
"github.com/arduino/arduino-cli/commands/lib"
26
26
"github.com/arduino/arduino-cli/internal/cli/feedback"
27
+ "github.com/arduino/arduino-cli/internal/cli/feedback/result"
27
28
"github.com/arduino/arduino-cli/internal/cli/instance"
28
29
rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1"
29
30
"github.com/arduino/arduino-cli/table"
@@ -59,9 +60,14 @@ not listed, they can be listed by adding the --all flag.`),
59
60
// List gets and prints a list of installed libraries.
60
61
func List (instance * rpc.Instance , args []string , all bool , updatable bool ) {
61
62
installedLibs := GetList (instance , args , all , updatable )
63
+
64
+ installedLibsResult := make ([]* result.InstalledLibrary , len (installedLibs ))
65
+ for i , v := range installedLibs {
66
+ installedLibsResult [i ] = result .NewInstalledLibrary (v )
67
+ }
62
68
feedback .PrintResult (installedResult {
63
69
onlyUpdates : updatable ,
64
- installedLibs : installedLibs ,
70
+ installedLibs : installedLibsResult ,
65
71
})
66
72
logrus .Info ("Done" )
67
73
}
@@ -113,7 +119,7 @@ func GetList(
113
119
// feedback.Result implementation
114
120
type installedResult struct {
115
121
onlyUpdates bool
116
- installedLibs []* rpc .InstalledLibrary
122
+ installedLibs []* result .InstalledLibrary
117
123
}
118
124
119
125
func (ir installedResult ) Data () interface {} {
@@ -140,23 +146,26 @@ func (ir installedResult) String() string {
140
146
141
147
lastName := ""
142
148
for _ , libMeta := range ir .installedLibs {
143
- lib := libMeta .GetLibrary ()
149
+ if libMeta == nil {
150
+ continue
151
+ }
152
+ lib := libMeta .Library
144
153
name := lib .Name
145
154
if name == lastName {
146
155
name = ` "`
147
156
} else {
148
157
lastName = name
149
158
}
150
159
151
- location := lib .GetLocation (). String ( )
160
+ location := string ( lib .Location )
152
161
if lib .ContainerPlatform != "" {
153
- location = lib .GetContainerPlatform ()
162
+ location = lib .ContainerPlatform
154
163
}
155
164
156
165
available := ""
157
166
sentence := ""
158
- if libMeta .GetRelease () != nil {
159
- available = libMeta .GetRelease (). GetVersion ()
167
+ if libMeta .Release != nil {
168
+ available = libMeta .Release . Version
160
169
sentence = lib .Sentence
161
170
}
162
171
0 commit comments