Skip to content

Commit 0e12e46

Browse files
cli: board list
1 parent b0e28d9 commit 0e12e46

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

internal/cli/board/list.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,27 +114,27 @@ func watchList(inst *rpc.Instance) {
114114
// output from this command requires special formatting, let's create a dedicated
115115
// feedback.Result implementation
116116
type listResult struct {
117-
ports []*result.DetectedPort
117+
Ports []*result.DetectedPort `json:"detected_ports"`
118118
}
119119

120120
func (dr listResult) Data() interface{} {
121-
return dr.ports
121+
return dr
122122
}
123123

124124
func (dr listResult) String() string {
125-
if len(dr.ports) == 0 {
125+
if len(dr.Ports) == 0 {
126126
return tr("No boards found.")
127127
}
128128

129-
sort.Slice(dr.ports, func(i, j int) bool {
130-
x, y := dr.ports[i].Port, dr.ports[j].Port
129+
sort.Slice(dr.Ports, func(i, j int) bool {
130+
x, y := dr.Ports[i].Port, dr.Ports[j].Port
131131
return x.Protocol < y.Protocol ||
132132
(x.Protocol == y.Protocol && x.Address < y.Address)
133133
})
134134

135135
t := table.New()
136136
t.SetHeader(tr("Port"), tr("Protocol"), tr("Type"), tr("Board Name"), tr("FQBN"), tr("Core"))
137-
for _, detectedPort := range dr.ports {
137+
for _, detectedPort := range dr.Ports {
138138
port := detectedPort.Port
139139
protocol := port.Protocol
140140
address := port.Address

0 commit comments

Comments
 (0)