@@ -17,8 +17,7 @@ package board
17
17
18
18
import (
19
19
"context"
20
- "os"
21
-
20
+ "fmt"
22
21
"github.com/arduino/arduino-cli/cli/errorcodes"
23
22
"github.com/arduino/arduino-cli/cli/feedback"
24
23
"github.com/arduino/arduino-cli/cli/instance"
@@ -27,15 +26,24 @@ import (
27
26
"github.com/arduino/arduino-cli/table"
28
27
"github.com/fatih/color"
29
28
"github.com/spf13/cobra"
29
+ "os"
30
30
)
31
31
32
- var detailsCommand = & cobra.Command {
33
- Use : "details <FQBN>" ,
34
- Short : "Print details about a board." ,
35
- Long : "Show information about a board, in particular if the board has options to be specified in the FQBN." ,
36
- Example : " " + os .Args [0 ] + " board details arduino:avr:nano" ,
37
- Args : cobra .ExactArgs (1 ),
38
- Run : runDetailsCommand ,
32
+ var showFullDetails bool
33
+
34
+ func initDetailsCommand () * cobra.Command {
35
+ var detailsCommand = & cobra.Command {
36
+ Use : "details <FQBN>" ,
37
+ Short : "Print details about a board." ,
38
+ Long : "Show information about a board, in particular if the board has options to be specified in the FQBN." ,
39
+ Example : " " + os .Args [0 ] + " board details arduino:avr:nano" ,
40
+ Args : cobra .ExactArgs (1 ),
41
+ Run : runDetailsCommand ,
42
+ }
43
+
44
+ detailsCommand .Flags ().BoolVarP (& showFullDetails , "full" , "f" , false , "Include full details in text output" )
45
+
46
+ return detailsCommand
39
47
}
40
48
41
49
func runDetailsCommand (cmd * cobra.Command , args []string ) {
@@ -85,18 +93,58 @@ func (dr detailsResult) String() string {
85
93
t := table .New ()
86
94
t .SetColumnWidthMode (1 , table .Average )
87
95
t .AddRow ("Board name:" , details .Name )
96
+ t .AddRow ("Board fqbn:" , details .Fqbn )
97
+ t .AddRow ("Board propertiesId:" , details .PropertiesId )
98
+ t .AddRow ("Board version:" , details .Version )
99
+
100
+ if details .Official {
101
+ t .AddRow () // get some space from above
102
+ t .AddRow ("Official Arduino board:" ,
103
+ table .NewCell ("✔" , color .New (color .FgGreen )))
104
+ }
88
105
89
- for i , tool := range details .RequiredTools {
106
+ for i , idp := range details .IdentificationPref {
90
107
if i == 0 {
91
108
t .AddRow () // get some space from above
92
- t .AddRow ("Required tools :" , tool . Packager + " :"+ tool . Name , "" , tool . Version )
109
+ t .AddRow ("Identification Preferences :" , "VID :"+ idp . UsbID . VID + " PID:" + idp . UsbID . PID )
93
110
continue
94
111
}
95
- t .AddRow ("" , tool . Packager + " :"+ tool . Name , "" , tool . Version )
112
+ t .AddRow ("" , "VID :"+ idp . UsbID . VID + " PID:" + idp . UsbID . PID )
96
113
}
97
114
98
- for _ , option := range details .ConfigOptions {
115
+ t .AddRow () // get some space from above
116
+ t .AddRow ("Package name:" , details .Package .Name )
117
+ t .AddRow ("Package maintainer:" , details .Package .Maintainer )
118
+ t .AddRow ("Package URL:" , details .Package .Url )
119
+ t .AddRow ("Package websiteURL:" , details .Package .WebsiteURL )
120
+ t .AddRow ("Package online help:" , details .Package .Help .Online )
121
+
122
+ t .AddRow () // get some space from above
123
+ t .AddRow ("Platform name:" , details .Platform .Name )
124
+ t .AddRow ("Platform category:" , details .Platform .Category )
125
+ t .AddRow ("Platform architecture:" , details .Platform .Architecture )
126
+ t .AddRow ("Platform URL:" , details .Platform .Url )
127
+ t .AddRow ("Platform file name:" , details .Platform .ArchiveFileName )
128
+ t .AddRow ("Platform size (bytes):" , fmt .Sprint (details .Platform .Size ))
129
+ t .AddRow ("Platform checksum:" , details .Platform .Checksum )
130
+
131
+ t .AddRow () // get some space from above
132
+ for _ , tool := range details .ToolsDependencies {
133
+ t .AddRow ("Required tools:" , tool .Packager + ":" + tool .Name , "" , tool .Version )
134
+ if showFullDetails {
135
+ for _ , sys := range tool .Systems {
136
+ t .AddRow ("" , "OS:" , "" , sys .Host )
137
+ t .AddRow ("" , "File:" , "" , sys .ArchiveFileName )
138
+ t .AddRow ("" , "Size (bytes):" , "" , fmt .Sprint (sys .Size ))
139
+ t .AddRow ("" , "Checksum:" , "" , sys .Checksum )
140
+ t .AddRow ("" , "URL:" , "" , sys .Url )
141
+ t .AddRow () // get some space from above
142
+ }
143
+ }
99
144
t .AddRow () // get some space from above
145
+ }
146
+
147
+ for _ , option := range details .ConfigOptions {
100
148
t .AddRow ("Option:" , option .OptionLabel , "" , option .Option )
101
149
for _ , value := range option .Values {
102
150
green := color .New (color .FgGreen )
0 commit comments