@@ -41,6 +41,7 @@ import (
41
41
var (
42
42
fqbnArg arguments.Fqbn
43
43
portArgs arguments.Port
44
+ profile arguments.Profile
44
45
verbose bool
45
46
verify bool
46
47
importDir string
@@ -66,6 +67,7 @@ func NewCommand() *cobra.Command {
66
67
67
68
fqbnArg .AddToCommand (uploadCommand )
68
69
portArgs .AddToCommand (uploadCommand )
70
+ profile .AddToCommand (uploadCommand )
69
71
uploadCommand .Flags ().StringVarP (& importDir , "input-dir" , "" , "" , tr ("Directory containing binaries to upload." ))
70
72
uploadCommand .Flags ().StringVarP (& importFile , "input-file" , "i" , "" , tr ("Binary file to upload." ))
71
73
uploadCommand .Flags ().BoolVarP (& verify , "verify" , "t" , false , tr ("Verify uploaded binary after the upload." ))
@@ -77,7 +79,6 @@ func NewCommand() *cobra.Command {
77
79
}
78
80
79
81
func runUploadCommand (command * cobra.Command , args []string ) {
80
- instance := instance .CreateAndInit ()
81
82
logrus .Info ("Executing `arduino-cli upload`" )
82
83
83
84
path := ""
@@ -95,6 +96,12 @@ func runUploadCommand(command *cobra.Command, args []string) {
95
96
feedback .Errorf (tr ("Error during Upload: %v" ), err )
96
97
os .Exit (errorcodes .ErrGeneric )
97
98
}
99
+
100
+ instance , profileFqbn := instance .CreateAndInitWithProfile (profile .Get (), sketchPath )
101
+ if fqbnArg .String () == "" {
102
+ fqbnArg .Set (profileFqbn )
103
+ }
104
+
98
105
fqbn , port := arguments .CalculateFQBNAndPort (& portArgs , & fqbnArg , instance , sk )
99
106
100
107
userFieldRes , err := upload .SupportedUserFields (context .Background (), & rpc.SupportedUserFieldsRequest {
0 commit comments