@@ -28,6 +28,7 @@ import (
2828)
2929
3030func initInitCommand (srv rpc.ArduinoCoreServiceServer ) * cobra.Command {
31+ var defaultProfile bool
3132 initCommand := & cobra.Command {
3233 Use : "init" ,
3334 Short : i18n .Tr ("Creates or updates the sketch project file." ),
@@ -38,15 +39,16 @@ func initInitCommand(srv rpc.ArduinoCoreServiceServer) *cobra.Command {
3839 " " + os .Args [0 ] + " config init --profile Uno_profile -b arduino:avr:uno" ,
3940 Args : cobra .MaximumNArgs (1 ),
4041 Run : func (cmd * cobra.Command , args []string ) {
41- runInitCommand (cmd .Context (), args , srv )
42+ runInitCommand (cmd .Context (), args , srv , defaultProfile )
4243 },
4344 }
4445 fqbnArg .AddToCommand (initCommand , srv )
4546 profileArg .AddToCommand (initCommand , srv )
47+ initCommand .Flags ().BoolVar (& defaultProfile , "default" , false , i18n .Tr ("Set the profile as the default one." ))
4648 return initCommand
4749}
4850
49- func runInitCommand (ctx context.Context , args []string , srv rpc.ArduinoCoreServiceServer ) {
51+ func runInitCommand (ctx context.Context , args []string , srv rpc.ArduinoCoreServiceServer , defaultProfile bool ) {
5052 path := ""
5153 if len (args ) > 0 {
5254 path = args [0 ]
@@ -56,7 +58,7 @@ func runInitCommand(ctx context.Context, args []string, srv rpc.ArduinoCoreServi
5658
5759 inst := instance .CreateAndInit (ctx , srv )
5860
59- resp , err := srv .InitProfile (ctx , & rpc.InitProfileRequest {Instance : inst , SketchPath : sketchPath .String (), ProfileName : profileArg .Get (), Fqbn : fqbnArg .String ()})
61+ resp , err := srv .InitProfile (ctx , & rpc.InitProfileRequest {Instance : inst , SketchPath : sketchPath .String (), ProfileName : profileArg .Get (), Fqbn : fqbnArg .String (), DefaultProfile : defaultProfile })
6062 if err != nil {
6163 feedback .Fatal (i18n .Tr ("Error initializing the project file: %v" , err ), feedback .ErrGeneric )
6264 }
0 commit comments