Skip to content

Commit 3ff8e09

Browse files
committed
Moved a batch of function from commands/* subpackage to commands (part 3)
1 parent 3d8f50a commit 3ff8e09

36 files changed

+49
-56
lines changed

commands/service.go

+5-6
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import (
2727
"github.com/arduino/arduino-cli/commands/monitor"
2828
"github.com/arduino/arduino-cli/commands/sketch"
2929
"github.com/arduino/arduino-cli/commands/updatecheck"
30-
"github.com/arduino/arduino-cli/commands/upload"
3130
rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1"
3231
"github.com/sirupsen/logrus"
3332
"google.golang.org/grpc/metadata"
@@ -299,7 +298,7 @@ func (s *ArduinoCoreServerImpl) Upload(req *rpc.UploadRequest, stream rpc.Arduin
299298
Message: &rpc.UploadResponse_ErrStream{ErrStream: data},
300299
})
301300
})
302-
res, err := upload.Upload(stream.Context(), req, outStream, errStream)
301+
res, err := Upload(stream.Context(), req, outStream, errStream)
303302
outStream.Close()
304303
errStream.Close()
305304
if res != nil {
@@ -329,7 +328,7 @@ func (s *ArduinoCoreServerImpl) UploadUsingProgrammer(req *rpc.UploadUsingProgra
329328
},
330329
})
331330
})
332-
err := upload.UsingProgrammer(stream.Context(), req, outStream, errStream)
331+
err := UploadUsingProgrammer(stream.Context(), req, outStream, errStream)
333332
outStream.Close()
334333
errStream.Close()
335334
if err != nil {
@@ -340,7 +339,7 @@ func (s *ArduinoCoreServerImpl) UploadUsingProgrammer(req *rpc.UploadUsingProgra
340339

341340
// SupportedUserFields FIXMEDOC
342341
func (s *ArduinoCoreServerImpl) SupportedUserFields(ctx context.Context, req *rpc.SupportedUserFieldsRequest) (*rpc.SupportedUserFieldsResponse, error) {
343-
res, err := upload.SupportedUserFields(ctx, req)
342+
res, err := SupportedUserFields(ctx, req)
344343
return res, convertErrorToRPCStatus(err)
345344
}
346345

@@ -361,7 +360,7 @@ func (s *ArduinoCoreServerImpl) BurnBootloader(req *rpc.BurnBootloaderRequest, s
361360
},
362361
})
363362
})
364-
resp, err := upload.BurnBootloader(stream.Context(), req, outStream, errStream)
363+
resp, err := BurnBootloader(stream.Context(), req, outStream, errStream)
365364
outStream.Close()
366365
errStream.Close()
367366
if err != nil {
@@ -372,7 +371,7 @@ func (s *ArduinoCoreServerImpl) BurnBootloader(req *rpc.BurnBootloaderRequest, s
372371

373372
// ListProgrammersAvailableForUpload FIXMEDOC
374373
func (s *ArduinoCoreServerImpl) ListProgrammersAvailableForUpload(ctx context.Context, req *rpc.ListProgrammersAvailableForUploadRequest) (*rpc.ListProgrammersAvailableForUploadResponse, error) {
375-
resp, err := upload.ListProgrammersAvailableForUpload(ctx, req)
374+
resp, err := ListProgrammersAvailableForUpload(ctx, req)
376375
return resp, convertErrorToRPCStatus(err)
377376
}
378377

commands/upload/upload.go renamed to commands/service_upload.go

+3-6
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
// Arduino software without disclosing the source code of your own applications.
1414
// To purchase a commercial license, send an email to license@arduino.cc.
1515

16-
package upload
16+
package commands
1717

1818
import (
1919
"context"
@@ -31,7 +31,6 @@ import (
3131
"github.com/arduino/arduino-cli/internal/arduino/cores/packagemanager"
3232
"github.com/arduino/arduino-cli/internal/arduino/globals"
3333
"github.com/arduino/arduino-cli/internal/arduino/sketch"
34-
"github.com/arduino/arduino-cli/internal/i18n"
3534
rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1"
3635
paths "github.com/arduino/go-paths-helper"
3736
properties "github.com/arduino/go-properties-orderedmap"
@@ -40,8 +39,6 @@ import (
4039
"github.com/sirupsen/logrus"
4140
)
4241

43-
var tr = i18n.Tr
44-
4542
// SupportedUserFields returns a SupportedUserFieldsResponse containing all the UserFields supported
4643
// by the upload tools needed by the board using the protocol specified in SupportedUserFieldsRequest.
4744
func SupportedUserFields(ctx context.Context, req *rpc.SupportedUserFieldsRequest) (*rpc.SupportedUserFieldsResponse, error) {
@@ -179,8 +176,8 @@ func Upload(ctx context.Context, req *rpc.UploadRequest, outStream io.Writer, er
179176
}, nil
180177
}
181178

182-
// UsingProgrammer FIXMEDOC
183-
func UsingProgrammer(ctx context.Context, req *rpc.UploadUsingProgrammerRequest, outStream io.Writer, errStream io.Writer) error {
179+
// UploadUsingProgrammer FIXMEDOC
180+
func UploadUsingProgrammer(ctx context.Context, req *rpc.UploadUsingProgrammerRequest, outStream io.Writer, errStream io.Writer) error {
184181
logrus.Tracef("Upload using programmer %s on %s started", req.GetSketchPath(), req.GetFqbn())
185182

186183
if req.GetProgrammer() == "" {

commands/upload/burnbootloader.go renamed to commands/service_upload_burnbootloader.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
// Arduino software without disclosing the source code of your own applications.
1414
// To purchase a commercial license, send an email to license@arduino.cc.
1515

16-
package upload
16+
package commands
1717

1818
import (
1919
"context"

commands/upload/programmers_list.go renamed to commands/service_upload_list_programmers.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
// Arduino software without disclosing the source code of your own applications.
1414
// To purchase a commercial license, send an email to license@arduino.cc.
1515

16-
package upload
16+
package commands
1717

1818
import (
1919
"context"

commands/upload/upload_test.go renamed to commands/service_upload_test.go

+32-32
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
// Arduino software without disclosing the source code of your own applications.
1414
// To purchase a commercial license, send an email to license@arduino.cc.
1515

16-
package upload
16+
package commands
1717

1818
import (
1919
"bytes"
@@ -32,23 +32,23 @@ import (
3232
)
3333

3434
func TestDetectSketchNameFromBuildPath(t *testing.T) {
35-
sk1, err1 := detectSketchNameFromBuildPath(paths.New("testdata/build_path_1"))
35+
sk1, err1 := detectSketchNameFromBuildPath(paths.New("testdata/upload/build_path_1"))
3636
require.NoError(t, err1)
3737
require.Equal(t, "sketch.ino", sk1)
3838

39-
sk2, err2 := detectSketchNameFromBuildPath(paths.New("testdata/build_path_2"))
39+
sk2, err2 := detectSketchNameFromBuildPath(paths.New("testdata/upload/build_path_2"))
4040
require.NoError(t, err2)
4141
require.Equal(t, "Blink.ino", sk2)
4242

43-
sk3, err3 := detectSketchNameFromBuildPath(paths.New("testdata/build_path_3"))
43+
sk3, err3 := detectSketchNameFromBuildPath(paths.New("testdata/upload/build_path_3"))
4444
require.Error(t, err3)
4545
require.Equal(t, "", sk3)
4646

47-
sk4, err4 := detectSketchNameFromBuildPath(paths.New("testdata/build_path_4"))
47+
sk4, err4 := detectSketchNameFromBuildPath(paths.New("testdata/upload/build_path_4"))
4848
require.Error(t, err4)
4949
require.Equal(t, "", sk4)
5050

51-
sk5, err5 := detectSketchNameFromBuildPath(paths.New("testdata/build_path_invalid"))
51+
sk5, err5 := detectSketchNameFromBuildPath(paths.New("testdata/upload/build_path_invalid"))
5252
require.Error(t, err5)
5353
require.Equal(t, "", sk5)
5454
}
@@ -63,7 +63,7 @@ func TestDetermineBuildPathAndSketchName(t *testing.T) {
6363
resSketchName string
6464
}
6565

66-
blonk, err := sketch.New(paths.New("testdata/Blonk"))
66+
blonk, err := sketch.New(paths.New("testdata/upload/Blonk"))
6767
require.NoError(t, err)
6868

6969
fqbn, err := cores.ParseFQBN("arduino:samd:mkr1000")
@@ -73,39 +73,39 @@ func TestDetermineBuildPathAndSketchName(t *testing.T) {
7373
// 00: error: no data passed in
7474
{"", "", nil, nil, "<nil>", ""},
7575
// 01: use importFile to detect build.path and project_name
76-
{"testdata/build_path_2/Blink.ino.hex", "", nil, nil, "testdata/build_path_2", "Blink.ino"},
76+
{"testdata/upload/build_path_2/Blink.ino.hex", "", nil, nil, "testdata/upload/build_path_2", "Blink.ino"},
7777
// 02: use importPath as build.path and project_name
78-
{"", "testdata/build_path_2", nil, nil, "testdata/build_path_2", "Blink.ino"},
78+
{"", "testdata/upload/build_path_2", nil, nil, "testdata/upload/build_path_2", "Blink.ino"},
7979
// 03: error: used both importPath and importFile
80-
{"testdata/build_path_2/Blink.ino.hex", "testdata/build_path_2", nil, nil, "<nil>", ""},
80+
{"testdata/upload/build_path_2/Blink.ino.hex", "testdata/upload/build_path_2", nil, nil, "<nil>", ""},
8181
// 04: only sketch without FQBN
8282
{"", "", blonk, nil, blonk.DefaultBuildPath().String(), "Blonk.ino"},
8383
// 05: use importFile to detect build.path and project_name, sketch is ignored.
84-
{"testdata/build_path_2/Blink.ino.hex", "", blonk, nil, "testdata/build_path_2", "Blink.ino"},
84+
{"testdata/upload/build_path_2/Blink.ino.hex", "", blonk, nil, "testdata/upload/build_path_2", "Blink.ino"},
8585
// 06: use importPath as build.path and Blink as project name, ignore the sketch Blonk
86-
{"", "testdata/build_path_2", blonk, nil, "testdata/build_path_2", "Blink.ino"},
86+
{"", "testdata/upload/build_path_2", blonk, nil, "testdata/upload/build_path_2", "Blink.ino"},
8787
// 07: error: used both importPath and importFile
88-
{"testdata/build_path_2/Blink.ino.hex", "testdata/build_path_2", blonk, nil, "<nil>", ""},
88+
{"testdata/upload/build_path_2/Blink.ino.hex", "testdata/upload/build_path_2", blonk, nil, "<nil>", ""},
8989
// 08: error: no data passed in
9090
{"", "", nil, fqbn, "<nil>", ""},
9191
// 09: use importFile to detect build.path and project_name, fqbn ignored
92-
{"testdata/build_path_2/Blink.ino.hex", "", nil, fqbn, "testdata/build_path_2", "Blink.ino"},
92+
{"testdata/upload/build_path_2/Blink.ino.hex", "", nil, fqbn, "testdata/upload/build_path_2", "Blink.ino"},
9393
// 10: use importPath as build.path and project_name, fqbn ignored
94-
{"", "testdata/build_path_2", nil, fqbn, "testdata/build_path_2", "Blink.ino"},
94+
{"", "testdata/upload/build_path_2", nil, fqbn, "testdata/upload/build_path_2", "Blink.ino"},
9595
// 11: error: used both importPath and importFile
96-
{"testdata/build_path_2/Blink.ino.hex", "testdata/build_path_2", nil, fqbn, "<nil>", ""},
96+
{"testdata/upload/build_path_2/Blink.ino.hex", "testdata/upload/build_path_2", nil, fqbn, "<nil>", ""},
9797
// 12: use sketch to determine project name and sketch+fqbn to determine build path
9898
{"", "", blonk, fqbn, blonk.DefaultBuildPath().String(), "Blonk.ino"},
9999
// 13: use importFile to detect build.path and project_name, sketch+fqbn is ignored.
100-
{"testdata/build_path_2/Blink.ino.hex", "", blonk, fqbn, "testdata/build_path_2", "Blink.ino"},
100+
{"testdata/upload/build_path_2/Blink.ino.hex", "", blonk, fqbn, "testdata/upload/build_path_2", "Blink.ino"},
101101
// 14: use importPath as build.path and Blink as project name, ignore the sketch Blonk, ignore fqbn
102-
{"", "testdata/build_path_2", blonk, fqbn, "testdata/build_path_2", "Blink.ino"},
102+
{"", "testdata/upload/build_path_2", blonk, fqbn, "testdata/upload/build_path_2", "Blink.ino"},
103103
// 15: error: used both importPath and importFile
104-
{"testdata/build_path_2/Blink.ino.hex", "testdata/build_path_2", blonk, fqbn, "<nil>", ""},
104+
{"testdata/upload/build_path_2/Blink.ino.hex", "testdata/upload/build_path_2", blonk, fqbn, "<nil>", ""},
105105
// 16: importPath containing multiple firmwares, but one has the same name as the containing folder
106-
{"", "testdata/firmware", nil, fqbn, "testdata/firmware", "firmware.ino"},
106+
{"", "testdata/upload/firmware", nil, fqbn, "testdata/upload/firmware", "firmware.ino"},
107107
// 17: importFile among multiple firmwares
108-
{"testdata/firmware/another_firmware.ino.bin", "", nil, fqbn, "testdata/firmware", "another_firmware.ino"},
108+
{"testdata/upload/firmware/another_firmware.ino.bin", "", nil, fqbn, "testdata/upload/firmware", "another_firmware.ino"},
109109
}
110110
for i, test := range tests {
111111
t.Run(fmt.Sprintf("SubTest%02d", i), func(t *testing.T) {
@@ -128,9 +128,9 @@ func TestDetermineBuildPathAndSketchName(t *testing.T) {
128128

129129
func TestUploadPropertiesComposition(t *testing.T) {
130130
pmb := packagemanager.NewBuilder(nil, nil, nil, nil, "test")
131-
errs := pmb.LoadHardwareFromDirectory(paths.New("testdata", "hardware"))
131+
errs := pmb.LoadHardwareFromDirectory(paths.New("testdata", "upload", "hardware"))
132132
require.Len(t, errs, 0)
133-
buildPath1 := paths.New("testdata", "build_path_1")
133+
buildPath1 := paths.New("testdata", "upload", "build_path_1")
134134
logrus.SetLevel(logrus.TraceLevel)
135135
type test struct {
136136
importDir *paths.Path
@@ -149,32 +149,32 @@ func TestUploadPropertiesComposition(t *testing.T) {
149149

150150
tests := []test{
151151
// 0: classic upload, requires port
152-
{buildPath1, "alice:avr:board1", "port", "serial", "", false, "conf-board1 conf-general conf-upload $$VERBOSE-VERIFY$$ protocol port -bspeed testdata/build_path_1/sketch.ino.hex\n", ""},
152+
{buildPath1, "alice:avr:board1", "port", "serial", "", false, "conf-board1 conf-general conf-upload $$VERBOSE-VERIFY$$ protocol port -bspeed testdata/upload/build_path_1/sketch.ino.hex\n", ""},
153153
{buildPath1, "alice:avr:board1", "", "", "", false, "FAIL", ""},
154154
// 2: classic upload, no port
155-
{buildPath1, "alice:avr:board2", "port", "serial", "", false, "conf-board1 conf-general conf-upload $$VERBOSE-VERIFY$$ protocol -bspeed testdata/build_path_1/sketch.ino.hex\n", ""},
156-
{buildPath1, "alice:avr:board2", "", "", "", false, "conf-board1 conf-general conf-upload $$VERBOSE-VERIFY$$ protocol -bspeed testdata/build_path_1/sketch.ino.hex\n", ""},
155+
{buildPath1, "alice:avr:board2", "port", "serial", "", false, "conf-board1 conf-general conf-upload $$VERBOSE-VERIFY$$ protocol -bspeed testdata/upload/build_path_1/sketch.ino.hex\n", ""},
156+
{buildPath1, "alice:avr:board2", "", "", "", false, "conf-board1 conf-general conf-upload $$VERBOSE-VERIFY$$ protocol -bspeed testdata/upload/build_path_1/sketch.ino.hex\n", ""},
157157

158158
// 4: upload with programmer, requires port
159-
{buildPath1, "alice:avr:board1", "port", "serial", "progr1", false, "conf-board1 conf-general conf-program $$VERBOSE-VERIFY$$ progprotocol port -bspeed testdata/build_path_1/sketch.ino.hex\n", ""},
159+
{buildPath1, "alice:avr:board1", "port", "serial", "progr1", false, "conf-board1 conf-general conf-program $$VERBOSE-VERIFY$$ progprotocol port -bspeed testdata/upload/build_path_1/sketch.ino.hex\n", ""},
160160
{buildPath1, "alice:avr:board1", "", "", "progr1", false, "FAIL", ""},
161161
// 6: upload with programmer, no port
162-
{buildPath1, "alice:avr:board1", "port", "serial", "progr2", false, "conf-board1 conf-general conf-program $$VERBOSE-VERIFY$$ prog2protocol -bspeed testdata/build_path_1/sketch.ino.hex\n", ""},
163-
{buildPath1, "alice:avr:board1", "", "", "progr2", false, "conf-board1 conf-general conf-program $$VERBOSE-VERIFY$$ prog2protocol -bspeed testdata/build_path_1/sketch.ino.hex\n", ""},
162+
{buildPath1, "alice:avr:board1", "port", "serial", "progr2", false, "conf-board1 conf-general conf-program $$VERBOSE-VERIFY$$ prog2protocol -bspeed testdata/upload/build_path_1/sketch.ino.hex\n", ""},
163+
{buildPath1, "alice:avr:board1", "", "", "progr2", false, "conf-board1 conf-general conf-program $$VERBOSE-VERIFY$$ prog2protocol -bspeed testdata/upload/build_path_1/sketch.ino.hex\n", ""},
164164
// 8: upload with programmer, require port through extra params
165-
{buildPath1, "alice:avr:board1", "port", "serial", "progr3", false, "conf-board1 conf-general conf-program $$VERBOSE-VERIFY$$ prog3protocol port -bspeed testdata/build_path_1/sketch.ino.hex\n", ""},
165+
{buildPath1, "alice:avr:board1", "port", "serial", "progr3", false, "conf-board1 conf-general conf-program $$VERBOSE-VERIFY$$ prog3protocol port -bspeed testdata/upload/build_path_1/sketch.ino.hex\n", ""},
166166
{buildPath1, "alice:avr:board1", "", "", "progr3", false, "FAIL", ""},
167167

168168
// 10: burn bootloader, require port
169169
{buildPath1, "alice:avr:board1", "port", "serial", "", true, "FAIL", ""}, // requires programmer
170170
{buildPath1, "alice:avr:board1", "port", "serial", "progr1", true,
171171
"ERASE conf-board1 conf-general conf-erase $$VERBOSE-VERIFY$$ genprog1protocol port -bspeed\n",
172-
"BURN conf-board1 conf-general conf-bootloader $$VERBOSE-VERIFY$$ genprog1protocol port -bspeed -F0xFF " + cwd + "/testdata/hardware/alice/avr/bootloaders/niceboot/niceboot.hex\n"},
172+
"BURN conf-board1 conf-general conf-bootloader $$VERBOSE-VERIFY$$ genprog1protocol port -bspeed -F0xFF " + cwd + "/testdata/upload/hardware/alice/avr/bootloaders/niceboot/niceboot.hex\n"},
173173

174174
// 12: burn bootloader, preferences override from programmers.txt
175175
{buildPath1, "alice:avr:board1", "port", "serial", "progr4", true,
176176
"ERASE conf-board1 conf-two-general conf-two-erase $$VERBOSE-VERIFY$$ prog4protocol-bootloader port -bspeed\n",
177-
"BURN conf-board1 conf-two-general conf-two-bootloader $$VERBOSE-VERIFY$$ prog4protocol-bootloader port -bspeed -F0xFF " + cwd + "/testdata/hardware/alice/avr/bootloaders/niceboot/niceboot.hex\n"},
177+
"BURN conf-board1 conf-two-general conf-two-bootloader $$VERBOSE-VERIFY$$ prog4protocol-bootloader port -bspeed -F0xFF " + cwd + "/testdata/upload/hardware/alice/avr/bootloaders/niceboot/niceboot.hex\n"},
178178
}
179179

180180
pm := pmb.Build()

internal/cli/arguments/completion.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import (
1919
"context"
2020

2121
"github.com/arduino/arduino-cli/commands"
22-
"github.com/arduino/arduino-cli/commands/upload"
2322
"github.com/arduino/arduino-cli/internal/cli/instance"
2423
rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1"
2524
)
@@ -58,7 +57,7 @@ func GetInstalledProgrammers() []string {
5857

5958
installedProgrammers := make(map[string]string)
6059
for _, board := range list.GetBoards() {
61-
programmers, _ := upload.ListProgrammersAvailableForUpload(context.Background(), &rpc.ListProgrammersAvailableForUploadRequest{
60+
programmers, _ := commands.ListProgrammersAvailableForUpload(context.Background(), &rpc.ListProgrammersAvailableForUploadRequest{
6261
Instance: inst,
6362
Fqbn: board.GetFqbn(),
6463
})

internal/cli/burnbootloader/burnbootloader.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ import (
2020
"errors"
2121
"os"
2222

23+
"github.com/arduino/arduino-cli/commands"
2324
"github.com/arduino/arduino-cli/commands/cmderrors"
24-
"github.com/arduino/arduino-cli/commands/upload"
2525
"github.com/arduino/arduino-cli/internal/cli/arguments"
2626
"github.com/arduino/arduino-cli/internal/cli/feedback"
2727
"github.com/arduino/arduino-cli/internal/cli/instance"
@@ -75,7 +75,7 @@ func runBootloaderCommand(command *cobra.Command, args []string) {
7575
}
7676

7777
stdOut, stdErr, res := feedback.OutputStreams()
78-
if _, err := upload.BurnBootloader(context.Background(), &rpc.BurnBootloaderRequest{
78+
if _, err := commands.BurnBootloader(context.Background(), &rpc.BurnBootloaderRequest{
7979
Instance: instance,
8080
Fqbn: fqbn.String(),
8181
Port: discoveryPort,

internal/cli/compile/compile.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import (
2727
"github.com/arduino/arduino-cli/commands"
2828
"github.com/arduino/arduino-cli/commands/cmderrors"
2929
"github.com/arduino/arduino-cli/commands/sketch"
30-
"github.com/arduino/arduino-cli/commands/upload"
3130
"github.com/arduino/arduino-cli/internal/cli/arguments"
3231
"github.com/arduino/arduino-cli/internal/cli/configuration"
3332
"github.com/arduino/arduino-cli/internal/cli/feedback"
@@ -249,7 +248,7 @@ func runCompileCommand(cmd *cobra.Command, args []string) {
249248

250249
var uploadRes *rpc.UploadResult
251250
if compileError == nil && uploadAfterCompile {
252-
userFieldRes, err := upload.SupportedUserFields(context.Background(), &rpc.SupportedUserFieldsRequest{
251+
userFieldRes, err := commands.SupportedUserFields(context.Background(), &rpc.SupportedUserFieldsRequest{
253252
Instance: inst,
254253
Fqbn: fqbn,
255254
Protocol: port.GetProtocol(),
@@ -288,7 +287,7 @@ func runCompileCommand(cmd *cobra.Command, args []string) {
288287
UserFields: fields,
289288
}
290289

291-
if res, err := upload.Upload(context.Background(), uploadRequest, stdOut, stdErr); err != nil {
290+
if res, err := commands.Upload(context.Background(), uploadRequest, stdOut, stdErr); err != nil {
292291
errcode := feedback.ErrGeneric
293292
if errors.Is(err, &cmderrors.ProgrammerRequiredForUploadError{}) {
294293
errcode = feedback.ErrMissingProgrammer

internal/cli/upload/upload.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import (
2525
"github.com/arduino/arduino-cli/commands"
2626
"github.com/arduino/arduino-cli/commands/cmderrors"
2727
sk "github.com/arduino/arduino-cli/commands/sketch"
28-
"github.com/arduino/arduino-cli/commands/upload"
2928
"github.com/arduino/arduino-cli/internal/cli/arguments"
3029
"github.com/arduino/arduino-cli/internal/cli/feedback"
3130
"github.com/arduino/arduino-cli/internal/cli/feedback/result"
@@ -117,7 +116,7 @@ func runUploadCommand(args []string, uploadFieldsArgs map[string]string) {
117116
defaultProtocol := sketch.GetDefaultProtocol()
118117
fqbn, port := arguments.CalculateFQBNAndPort(&portArgs, &fqbnArg, inst, defaultFQBN, defaultAddress, defaultProtocol)
119118

120-
userFieldRes, err := upload.SupportedUserFields(context.Background(), &rpc.SupportedUserFieldsRequest{
119+
userFieldRes, err := commands.SupportedUserFields(context.Background(), &rpc.SupportedUserFieldsRequest{
121120
Instance: inst,
122121
Fqbn: fqbn,
123122
Protocol: port.GetProtocol(),
@@ -198,7 +197,7 @@ func runUploadCommand(args []string, uploadFieldsArgs map[string]string) {
198197
DryRun: dryRun,
199198
UserFields: fields,
200199
}
201-
if res, err := upload.Upload(context.Background(), req, stdOut, stdErr); err != nil {
200+
if res, err := commands.Upload(context.Background(), req, stdOut, stdErr); err != nil {
202201
errcode := feedback.ErrGeneric
203202
if errors.Is(err, &cmderrors.ProgrammerRequiredForUploadError{}) {
204203
errcode = feedback.ErrMissingProgrammer

0 commit comments

Comments
 (0)