@@ -114,27 +114,27 @@ func watchList(inst *rpc.Instance) {
114
114
// output from this command requires special formatting, let's create a dedicated
115
115
// feedback.Result implementation
116
116
type listResult struct {
117
- ports []* result.DetectedPort
117
+ Ports []* result.DetectedPort `json:"detected_ports"`
118
118
}
119
119
120
120
func (dr listResult ) Data () interface {} {
121
- return dr . ports
121
+ return dr
122
122
}
123
123
124
124
func (dr listResult ) String () string {
125
- if len (dr .ports ) == 0 {
125
+ if len (dr .Ports ) == 0 {
126
126
return tr ("No boards found." )
127
127
}
128
128
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
131
131
return x .Protocol < y .Protocol ||
132
132
(x .Protocol == y .Protocol && x .Address < y .Address )
133
133
})
134
134
135
135
t := table .New ()
136
136
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 {
138
138
port := detectedPort .Port
139
139
protocol := port .Protocol
140
140
address := port .Address
0 commit comments