@@ -25,6 +25,7 @@ import (
25
25
"github.com/arduino/arduino-cli/commands/lib"
26
26
"github.com/arduino/arduino-cli/internal/cli/arguments"
27
27
"github.com/arduino/arduino-cli/internal/cli/feedback"
28
+ "github.com/arduino/arduino-cli/internal/cli/feedback/result"
28
29
"github.com/arduino/arduino-cli/internal/cli/instance"
29
30
rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1"
30
31
"github.com/arduino/go-paths-helper"
@@ -75,7 +76,7 @@ func runExamplesCommand(cmd *cobra.Command, args []string) {
75
76
found := []* libraryExamples {}
76
77
for _ , lib := range res .GetInstalledLibraries () {
77
78
found = append (found , & libraryExamples {
78
- Library : lib .Library ,
79
+ Library : result . NewLibrary ( lib .Library ) ,
79
80
Examples : lib .Library .Examples ,
80
81
})
81
82
}
@@ -88,8 +89,8 @@ func runExamplesCommand(cmd *cobra.Command, args []string) {
88
89
// feedback.Result implementation
89
90
90
91
type libraryExamples struct {
91
- Library * rpc .Library `json:"library"`
92
- Examples []string `json:"examples"`
92
+ Library * result .Library `json:"library"`
93
+ Examples []string `json:"examples"`
93
94
}
94
95
95
96
type libraryExamplesResult struct {
@@ -113,9 +114,9 @@ func (ir libraryExamplesResult) String() string {
113
114
for _ , lib := range ir .Examples {
114
115
name := lib .Library .Name
115
116
if lib .Library .ContainerPlatform != "" {
116
- name += " (" + lib .Library .GetContainerPlatform () + ")"
117
- } else if lib .Library .Location != rpc .LibraryLocation_LIBRARY_LOCATION_USER {
118
- name += " (" + lib .Library .GetLocation (). String ( ) + ")"
117
+ name += " (" + lib .Library .ContainerPlatform + ")"
118
+ } else if string ( lib .Library .Location ) != rpc .LibraryLocation_name [ int32 ( rpc . LibraryLocation_LIBRARY_LOCATION_USER )] {
119
+ name += " (" + string ( lib .Library .Location ) + ")"
119
120
}
120
121
r := tr ("Examples for library %s" , color .GreenString ("%s" , name )) + "\n "
121
122
sort .Slice (lib .Examples , func (i , j int ) bool {
0 commit comments