@@ -22,6 +22,7 @@ import (
2222
2323 "github.com/arduino/arduino-cli/commands/board"
2424 "github.com/arduino/arduino-cli/internal/cli/arguments"
25+ "github.com/arduino/arduino-cli/internal/cli/compile"
2526 "github.com/arduino/arduino-cli/internal/cli/feedback"
2627 "github.com/arduino/arduino-cli/internal/cli/instance"
2728 rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1"
@@ -35,43 +36,52 @@ func initDetailsCommand() *cobra.Command {
3536 var showFullDetails bool
3637 var listProgrammers bool
3738 var fqbn arguments.Fqbn
39+ var showProperties arguments.ShowProperties
3840 var detailsCommand = & cobra.Command {
3941 Use : fmt .Sprintf ("details -b <%s>" , tr ("FQBN" )),
4042 Short : tr ("Print details about a board." ),
4143 Long : tr ("Show information about a board, in particular if the board has options to be specified in the FQBN." ),
4244 Example : " " + os .Args [0 ] + " board details -b arduino:avr:nano" ,
4345 Args : cobra .NoArgs ,
4446 Run : func (cmd * cobra.Command , args []string ) {
45- runDetailsCommand (fqbn .String (), showFullDetails , listProgrammers )
47+ runDetailsCommand (fqbn .String (), showFullDetails , listProgrammers , showProperties )
4648 },
4749 }
4850
4951 fqbn .AddToCommand (detailsCommand )
5052 detailsCommand .Flags ().BoolVarP (& showFullDetails , "full" , "f" , false , tr ("Show full board details" ))
5153 detailsCommand .Flags ().BoolVarP (& listProgrammers , "list-programmers" , "" , false , tr ("Show list of available programmers" ))
5254 detailsCommand .MarkFlagRequired ("fqbn" )
53-
55+ showProperties . AddToCommand ( detailsCommand )
5456 return detailsCommand
5557}
5658
57- func runDetailsCommand (fqbn string , showFullDetails , listProgrammers bool ) {
59+ func runDetailsCommand (fqbn string , showFullDetails , listProgrammers bool , showProperties arguments. ShowProperties ) {
5860 inst := instance .CreateAndInit ()
5961
6062 logrus .Info ("Executing `arduino-cli board details`" )
6163
64+ showPropertiesMode , err := showProperties .Get ()
65+ if err != nil {
66+ feedback .Fatal (err .Error (), feedback .ErrBadArgument )
67+ }
6268 res , err := board .Details (context .Background (), & rpc.BoardDetailsRequest {
6369 Instance : inst ,
6470 Fqbn : fqbn ,
6571 })
66-
6772 if err != nil {
6873 feedback .Fatal (tr ("Error getting board details: %v" , err ), feedback .ErrGeneric )
6974 }
7075
76+ if showPropertiesMode == arguments .ShowPropertiesExpanded {
77+ res .BuildProperties , _ = compile .ExpandBuildProperties (res .GetBuildProperties ())
78+ }
79+
7180 feedback .PrintResult (detailsResult {
7281 details : res ,
7382 listProgrammers : listProgrammers ,
7483 showFullDetails : showFullDetails ,
84+ showProperties : showPropertiesMode != arguments .ShowPropertiesDisabled ,
7585 })
7686}
7787
@@ -81,6 +91,7 @@ type detailsResult struct {
8191 details * rpc.BoardDetailsResponse
8292 listProgrammers bool
8393 showFullDetails bool
94+ showProperties bool
8495}
8596
8697func (dr detailsResult ) Data () interface {} {
@@ -90,6 +101,14 @@ func (dr detailsResult) Data() interface{} {
90101func (dr detailsResult ) String () string {
91102 details := dr .details
92103
104+ if dr .showProperties {
105+ res := ""
106+ for _ , prop := range details .GetBuildProperties () {
107+ res += fmt .Sprintln (prop )
108+ }
109+ return res
110+ }
111+
93112 if dr .listProgrammers {
94113 t := table .New ()
95114 t .AddRow (tr ("Id" ), tr ("Programmer name" ))
0 commit comments