Skip to content

Commit 8527015

Browse files
committed
Draft implementation of upload with profiles
1 parent c21147b commit 8527015

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

cli/upload/upload.go

+8-1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ import (
4141
var (
4242
fqbnArg arguments.Fqbn
4343
portArgs arguments.Port
44+
profile arguments.Profile
4445
verbose bool
4546
verify bool
4647
importDir string
@@ -66,6 +67,7 @@ func NewCommand() *cobra.Command {
6667

6768
fqbnArg.AddToCommand(uploadCommand)
6869
portArgs.AddToCommand(uploadCommand)
70+
profile.AddToCommand(uploadCommand)
6971
uploadCommand.Flags().StringVarP(&importDir, "input-dir", "", "", tr("Directory containing binaries to upload."))
7072
uploadCommand.Flags().StringVarP(&importFile, "input-file", "i", "", tr("Binary file to upload."))
7173
uploadCommand.Flags().BoolVarP(&verify, "verify", "t", false, tr("Verify uploaded binary after the upload."))
@@ -77,7 +79,6 @@ func NewCommand() *cobra.Command {
7779
}
7880

7981
func runUploadCommand(command *cobra.Command, args []string) {
80-
instance := instance.CreateAndInit()
8182
logrus.Info("Executing `arduino-cli upload`")
8283

8384
path := ""
@@ -95,6 +96,12 @@ func runUploadCommand(command *cobra.Command, args []string) {
9596
feedback.Errorf(tr("Error during Upload: %v"), err)
9697
os.Exit(errorcodes.ErrGeneric)
9798
}
99+
100+
instance, profileFqbn := instance.CreateAndInitWithProfile(profile.Get(), sketchPath)
101+
if fqbnArg.String() == "" {
102+
fqbnArg.Set(profileFqbn)
103+
}
104+
98105
fqbn, port := arguments.CalculateFQBNAndPort(&portArgs, &fqbnArg, instance, sk)
99106

100107
userFieldRes, err := upload.SupportedUserFields(context.Background(), &rpc.SupportedUserFieldsRequest{

0 commit comments

Comments
 (0)