Skip to content

Commit 8c197cd

Browse files
committed
Moved a batch of function from commands/* subpackage to commands (part 5)
1 parent a2d9f80 commit 8c197cd

File tree

14 files changed

+13
-18
lines changed

14 files changed

+13
-18
lines changed

Diff for: commands/service_debug.go

+3-4
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import (
2020
"errors"
2121
"os"
2222

23-
cmd "github.com/arduino/arduino-cli/commands/debug"
2423
rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1"
2524
)
2625

@@ -44,7 +43,7 @@ func (s *ArduinoCoreServerImpl) Debug(stream rpc.ArduinoCoreService_DebugServer)
4443
signalChan := make(chan os.Signal)
4544
defer close(signalChan)
4645
outStream := feedStreamTo(func(data []byte) { stream.Send(&rpc.DebugResponse{Data: data}) })
47-
resp, debugErr := cmd.Debug(stream.Context(), req,
46+
resp, debugErr := Debug(stream.Context(), req,
4847
consumeStreamFrom(func() ([]byte, error) {
4948
command, err := stream.Recv()
5049
if command.GetSendInterrupt() {
@@ -63,12 +62,12 @@ func (s *ArduinoCoreServerImpl) Debug(stream rpc.ArduinoCoreService_DebugServer)
6362

6463
// GetDebugConfig return metadata about a debug session
6564
func (s *ArduinoCoreServerImpl) GetDebugConfig(ctx context.Context, req *rpc.GetDebugConfigRequest) (*rpc.GetDebugConfigResponse, error) {
66-
res, err := cmd.GetDebugConfig(ctx, req)
65+
res, err := GetDebugConfig(ctx, req)
6766
return res, convertErrorToRPCStatus(err)
6867
}
6968

7069
// IsDebugSupported checks if debugging is supported for a given configuration
7170
func (s *ArduinoCoreServerImpl) IsDebugSupported(ctx context.Context, req *rpc.IsDebugSupportedRequest) (*rpc.IsDebugSupportedResponse, error) {
72-
res, err := cmd.IsDebugSupported(ctx, req)
71+
res, err := IsDebugSupported(ctx, req)
7372
return res, convertErrorToRPCStatus(err)
7473
}

Diff for: commands/debug/debug_info.go renamed to commands/service_debug_config.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 [email protected].
1515

16-
package debug
16+
package commands
1717

1818
import (
1919
"context"

Diff for: commands/debug/debug.go renamed to commands/service_debug_run.go

+1-4
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 [email protected].
1515

16-
package debug
16+
package commands
1717

1818
import (
1919
"context"
@@ -27,14 +27,11 @@ import (
2727
"github.com/arduino/arduino-cli/commands/cmderrors"
2828
"github.com/arduino/arduino-cli/commands/internal/instances"
2929
"github.com/arduino/arduino-cli/internal/arduino/cores/packagemanager"
30-
"github.com/arduino/arduino-cli/internal/i18n"
3130
rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1"
3231
"github.com/arduino/go-paths-helper"
3332
"github.com/sirupsen/logrus"
3433
)
3534

36-
var tr = i18n.Tr
37-
3835
// Debug command launches a debug tool for a sketch.
3936
// It also implements streams routing:
4037
// gRPC In -> tool stdIn

Diff for: commands/debug/debug_test.go renamed to commands/service_debug_test.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// modify or otherwise use the software for commercial activities involving the
1313
// Arduino software without disclosing the source code of your own applications.
1414
// To purchase a commercial license, send an email to [email protected].
15-
package debug
15+
package commands
1616

1717
import (
1818
"fmt"
@@ -30,10 +30,10 @@ import (
3030
)
3131

3232
func TestGetCommandLine(t *testing.T) {
33-
customHardware := paths.New("testdata", "custom_hardware")
34-
dataDir := paths.New("testdata", "data_dir", "packages")
33+
customHardware := paths.New("testdata", "debug", "custom_hardware")
34+
dataDir := paths.New("testdata", "debug", "data_dir", "packages")
3535
sketch := "hello"
36-
sketchPath := paths.New("testdata", sketch)
36+
sketchPath := paths.New("testdata", "debug", sketch)
3737
require.NoError(t, sketchPath.ToAbs())
3838

3939
pmb := packagemanager.NewBuilder(nil, nil, nil, nil, "test")
File renamed without changes.

Diff for: internal/cli/debug/debug.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import (
2424

2525
"github.com/arduino/arduino-cli/commands"
2626
"github.com/arduino/arduino-cli/commands/cmderrors"
27-
"github.com/arduino/arduino-cli/commands/debug"
2827
"github.com/arduino/arduino-cli/internal/cli/arguments"
2928
"github.com/arduino/arduino-cli/internal/cli/feedback"
3029
"github.com/arduino/arduino-cli/internal/cli/feedback/table"
@@ -124,7 +123,7 @@ func runDebugCommand(args []string, portArgs *arguments.Port, fqbnArg *arguments
124123

125124
if printInfo {
126125

127-
if res, err := debug.GetDebugConfig(context.Background(), debugConfigRequested); err != nil {
126+
if res, err := commands.GetDebugConfig(context.Background(), debugConfigRequested); err != nil {
128127
errcode := feedback.ErrBadArgument
129128
if errors.Is(err, &cmderrors.MissingProgrammerError{}) {
130129
errcode = feedback.ErrMissingProgrammer
@@ -144,7 +143,7 @@ func runDebugCommand(args []string, portArgs *arguments.Port, fqbnArg *arguments
144143
if err != nil {
145144
feedback.FatalError(err, feedback.ErrBadArgument)
146145
}
147-
if _, err := debug.Debug(context.Background(), debugConfigRequested, in, out, ctrlc); err != nil {
146+
if _, err := commands.Debug(context.Background(), debugConfigRequested, in, out, ctrlc); err != nil {
148147
errcode := feedback.ErrGeneric
149148
if errors.Is(err, &cmderrors.MissingProgrammerError{}) {
150149
errcode = feedback.ErrMissingProgrammer

Diff for: internal/cli/debug/debug_check.go

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

22-
"github.com/arduino/arduino-cli/commands/debug"
22+
"github.com/arduino/arduino-cli/commands"
2323
"github.com/arduino/arduino-cli/internal/cli/arguments"
2424
"github.com/arduino/arduino-cli/internal/cli/feedback"
2525
"github.com/arduino/arduino-cli/internal/cli/feedback/result"
@@ -60,7 +60,7 @@ func runDebugCheckCommand(portArgs *arguments.Port, fqbnArg *arguments.Fqbn, int
6060
feedback.FatalError(err, feedback.ErrBadArgument)
6161
}
6262
fqbn := fqbnArg.String()
63-
resp, err := debug.IsDebugSupported(context.Background(), &rpc.IsDebugSupportedRequest{
63+
resp, err := commands.IsDebugSupported(context.Background(), &rpc.IsDebugSupportedRequest{
6464
Instance: instance,
6565
Fqbn: fqbn,
6666
Port: port,

0 commit comments

Comments
 (0)