@@ -17,8 +17,7 @@ package board
1717
1818import (
1919 "context"
20- "os"
21-
20+ "fmt"
2221 "github.com/arduino/arduino-cli/cli/errorcodes"
2322 "github.com/arduino/arduino-cli/cli/feedback"
2423 "github.com/arduino/arduino-cli/cli/instance"
@@ -27,15 +26,24 @@ import (
2726 "github.com/arduino/arduino-cli/table"
2827 "github.com/fatih/color"
2928 "github.com/spf13/cobra"
29+ "os"
3030)
3131
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
3947}
4048
4149func runDetailsCommand (cmd * cobra.Command , args []string ) {
@@ -85,18 +93,58 @@ func (dr detailsResult) String() string {
8593 t := table .New ()
8694 t .SetColumnWidthMode (1 , table .Average )
8795 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+ }
88105
89- for i , tool := range details .RequiredTools {
106+ for i , idp := range details .IdentificationPref {
90107 if i == 0 {
91108 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 )
93110 continue
94111 }
95- t .AddRow ("" , tool . Packager + " :"+ tool . Name , "" , tool . Version )
112+ t .AddRow ("" , "VID :"+ idp . UsbID . VID + " PID:" + idp . UsbID . PID )
96113 }
97114
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+ }
99144 t .AddRow () // get some space from above
145+ }
146+
147+ for _ , option := range details .ConfigOptions {
100148 t .AddRow ("Option:" , option .OptionLabel , "" , option .Option )
101149 for _ , value := range option .Values {
102150 green := color .New (color .FgGreen )
0 commit comments