Skip to content

Commit ebff649

Browse files
committed
Follow convetion where context must be the first argument
1 parent ea57c70 commit ebff649

37 files changed

+86
-86
lines changed

Diff for: internal/cli/arguments/completion.go

+18-18
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ import (
2727
// GetInstalledBoards is an helper function useful to autocomplete.
2828
// It returns a list of fqbn
2929
// it's taken from cli/board/listall.go
30-
func GetInstalledBoards(srv rpc.ArduinoCoreServiceServer, ctx context.Context) []string {
31-
inst := instance.CreateAndInit(srv, ctx)
30+
func GetInstalledBoards(ctx context.Context, srv rpc.ArduinoCoreServiceServer) []string {
31+
inst := instance.CreateAndInit(ctx, srv)
3232

3333
list, _ := srv.BoardListAll(context.Background(), &rpc.BoardListAllRequest{
3434
Instance: inst,
@@ -45,8 +45,8 @@ func GetInstalledBoards(srv rpc.ArduinoCoreServiceServer, ctx context.Context) [
4545

4646
// GetInstalledProgrammers is an helper function useful to autocomplete.
4747
// It returns a list of programmers available based on the installed boards
48-
func GetInstalledProgrammers(srv rpc.ArduinoCoreServiceServer, ctx context.Context) []string {
49-
inst := instance.CreateAndInit(srv, ctx)
48+
func GetInstalledProgrammers(ctx context.Context, srv rpc.ArduinoCoreServiceServer) []string {
49+
inst := instance.CreateAndInit(ctx, srv)
5050

5151
// we need the list of the available fqbn in order to get the list of the programmers
5252
listAllReq := &rpc.BoardListAllRequest{
@@ -78,8 +78,8 @@ func GetInstalledProgrammers(srv rpc.ArduinoCoreServiceServer, ctx context.Conte
7878

7979
// GetUninstallableCores is an helper function useful to autocomplete.
8080
// It returns a list of cores which can be uninstalled
81-
func GetUninstallableCores(srv rpc.ArduinoCoreServiceServer, ctx context.Context) []string {
82-
inst := instance.CreateAndInit(srv, ctx)
81+
func GetUninstallableCores(ctx context.Context, srv rpc.ArduinoCoreServiceServer) []string {
82+
inst := instance.CreateAndInit(ctx, srv)
8383

8484
platforms, _ := commands.PlatformSearch(&rpc.PlatformSearchRequest{
8585
Instance: inst,
@@ -99,8 +99,8 @@ func GetUninstallableCores(srv rpc.ArduinoCoreServiceServer, ctx context.Context
9999

100100
// GetInstallableCores is an helper function useful to autocomplete.
101101
// It returns a list of cores which can be installed/downloaded
102-
func GetInstallableCores(srv rpc.ArduinoCoreServiceServer, ctx context.Context) []string {
103-
inst := instance.CreateAndInit(srv, ctx)
102+
func GetInstallableCores(ctx context.Context, srv rpc.ArduinoCoreServiceServer) []string {
103+
inst := instance.CreateAndInit(ctx, srv)
104104

105105
platforms, _ := commands.PlatformSearch(&rpc.PlatformSearchRequest{
106106
Instance: inst,
@@ -118,18 +118,18 @@ func GetInstallableCores(srv rpc.ArduinoCoreServiceServer, ctx context.Context)
118118

119119
// GetInstalledLibraries is an helper function useful to autocomplete.
120120
// It returns a list of libs which are currently installed, including the builtin ones
121-
func GetInstalledLibraries(srv rpc.ArduinoCoreServiceServer, ctx context.Context) []string {
122-
return getLibraries(srv, ctx, true)
121+
func GetInstalledLibraries(ctx context.Context, srv rpc.ArduinoCoreServiceServer) []string {
122+
return getLibraries(ctx, srv, true)
123123
}
124124

125125
// GetUninstallableLibraries is an helper function useful to autocomplete.
126126
// It returns a list of libs which can be uninstalled
127-
func GetUninstallableLibraries(srv rpc.ArduinoCoreServiceServer, ctx context.Context) []string {
128-
return getLibraries(srv, ctx, false)
127+
func GetUninstallableLibraries(ctx context.Context, srv rpc.ArduinoCoreServiceServer) []string {
128+
return getLibraries(ctx, srv, false)
129129
}
130130

131-
func getLibraries(srv rpc.ArduinoCoreServiceServer, ctx context.Context, all bool) []string {
132-
inst := instance.CreateAndInit(srv, ctx)
131+
func getLibraries(ctx context.Context, srv rpc.ArduinoCoreServiceServer, all bool) []string {
132+
inst := instance.CreateAndInit(ctx, srv)
133133
libs, _ := commands.LibraryList(context.Background(), &rpc.LibraryListRequest{
134134
Instance: inst,
135135
All: all,
@@ -147,8 +147,8 @@ func getLibraries(srv rpc.ArduinoCoreServiceServer, ctx context.Context, all boo
147147

148148
// GetInstallableLibs is an helper function useful to autocomplete.
149149
// It returns a list of libs which can be installed/downloaded
150-
func GetInstallableLibs(srv rpc.ArduinoCoreServiceServer, ctx context.Context) []string {
151-
inst := instance.CreateAndInit(srv, ctx)
150+
func GetInstallableLibs(ctx context.Context, srv rpc.ArduinoCoreServiceServer) []string {
151+
inst := instance.CreateAndInit(ctx, srv)
152152

153153
libs, _ := commands.LibrarySearch(context.Background(), &rpc.LibrarySearchRequest{
154154
Instance: inst,
@@ -165,9 +165,9 @@ func GetInstallableLibs(srv rpc.ArduinoCoreServiceServer, ctx context.Context) [
165165
// GetAvailablePorts is an helper function useful to autocomplete.
166166
// It returns a list of upload port of the boards which are currently connected.
167167
// It will not suggests network ports because the timeout is not set.
168-
func GetAvailablePorts(srv rpc.ArduinoCoreServiceServer, ctx context.Context) []*rpc.Port {
168+
func GetAvailablePorts(ctx context.Context, srv rpc.ArduinoCoreServiceServer) []*rpc.Port {
169169
// Get the port list
170-
inst := instance.CreateAndInit(srv, ctx)
170+
inst := instance.CreateAndInit(ctx, srv)
171171
list, _ := srv.BoardList(ctx, &rpc.BoardListRequest{Instance: inst})
172172

173173
// Transform the data structure for the completion (DetectedPort -> Port)

Diff for: internal/cli/arguments/fqbn.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ type Fqbn struct {
3737
func (f *Fqbn) AddToCommand(cmd *cobra.Command, srv rpc.ArduinoCoreServiceServer) {
3838
cmd.Flags().StringVarP(&f.fqbn, "fqbn", "b", "", tr("Fully Qualified Board Name, e.g.: arduino:avr:uno"))
3939
cmd.RegisterFlagCompletionFunc("fqbn", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
40-
return GetInstalledBoards(srv, context.Background()), cobra.ShellCompDirectiveDefault
40+
return GetInstalledBoards(context.Background(), srv), cobra.ShellCompDirectiveDefault
4141
})
4242
cmd.Flags().StringSliceVar(&f.boardOptions, "board-options", []string{},
4343
tr("List of board options separated by commas. Or can be used multiple times for multiple options."))

Diff for: internal/cli/arguments/port.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@ type Port struct {
4242
func (p *Port) AddToCommand(cmd *cobra.Command, srv rpc.ArduinoCoreServiceServer) {
4343
cmd.Flags().StringVarP(&p.address, "port", "p", "", tr("Upload port address, e.g.: COM3 or /dev/ttyACM2"))
4444
cmd.RegisterFlagCompletionFunc("port", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
45-
return f.Map(GetAvailablePorts(srv, context.Background()), (*rpc.Port).GetAddress), cobra.ShellCompDirectiveDefault
45+
return f.Map(GetAvailablePorts(context.Background(), srv), (*rpc.Port).GetAddress), cobra.ShellCompDirectiveDefault
4646
})
4747
cmd.Flags().StringVarP(&p.protocol, "protocol", "l", "", tr("Upload port protocol, e.g: serial"))
4848
cmd.RegisterFlagCompletionFunc("protocol", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
49-
return f.Map(GetAvailablePorts(srv, context.Background()), (*rpc.Port).GetProtocol), cobra.ShellCompDirectiveDefault
49+
return f.Map(GetAvailablePorts(context.Background(), srv), (*rpc.Port).GetProtocol), cobra.ShellCompDirectiveDefault
5050
})
5151
p.timeout.AddToCommand(cmd)
5252
}

Diff for: internal/cli/arguments/programmer.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ type Programmer struct {
3333
func (p *Programmer) AddToCommand(cmd *cobra.Command, srv rpc.ArduinoCoreServiceServer) {
3434
cmd.Flags().StringVarP(&p.programmer, "programmer", "P", "", tr("Programmer to use, e.g: atmel_ice"))
3535
cmd.RegisterFlagCompletionFunc("programmer", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
36-
return GetInstalledProgrammers(srv, context.Background()), cobra.ShellCompDirectiveDefault
36+
return GetInstalledProgrammers(context.Background(), srv), cobra.ShellCompDirectiveDefault
3737
})
3838
}
3939

Diff for: internal/cli/arguments/reference.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@ func (r *Reference) String() string {
4444

4545
// ParseReferences is a convenient wrapper that operates on a slice of strings and
4646
// calls ParseReference for each of them. It returns at the first invalid argument.
47-
func ParseReferences(srv rpc.ArduinoCoreServiceServer, ctx context.Context, args []string) ([]*Reference, error) {
47+
func ParseReferences(ctx context.Context, srv rpc.ArduinoCoreServiceServer, args []string) ([]*Reference, error) {
4848
ret := []*Reference{}
4949
for _, arg := range args {
5050
// TODO: This is quite resource consuming (since it creates a new instance for each call)
51-
reference, err := ParseReference(srv, ctx, arg)
51+
reference, err := ParseReference(ctx, srv, arg)
5252
if err != nil {
5353
return nil, err
5454
}
@@ -62,7 +62,7 @@ func ParseReferences(srv rpc.ArduinoCoreServiceServer, ctx context.Context, args
6262
// To achieve that, it tries to use github.com/arduino/arduino-cli/commands/core.GetPlatform
6363
// Note that the Reference is returned rightaway if the arg inserted by the user matches perfectly one in the response of core.GetPlatform
6464
// A MultiplePlatformsError is returned if the platform searched by the user matches multiple platforms
65-
func ParseReference(srv rpc.ArduinoCoreServiceServer, ctx context.Context, arg string) (*Reference, error) {
65+
func ParseReference(ctx context.Context, srv rpc.ArduinoCoreServiceServer, arg string) (*Reference, error) {
6666
logrus.Infof("Parsing reference %s", arg)
6767
ret := &Reference{}
6868
if arg == "" {
@@ -98,7 +98,7 @@ func ParseReference(srv rpc.ArduinoCoreServiceServer, ctx context.Context, arg s
9898
// try to use core.PlatformList to optimize what the user typed
9999
// (by replacing the PackageName and Architecture in ret with the content of core.GetPlatform())
100100
platforms, _ := commands.PlatformSearch(&rpc.PlatformSearchRequest{
101-
Instance: instance.CreateAndInit(srv, ctx),
101+
Instance: instance.CreateAndInit(ctx, srv),
102102
})
103103
foundPlatforms := []string{}
104104
for _, platform := range platforms.GetSearchOutput() {

Diff for: internal/cli/arguments/reference_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,13 @@ func TestParseReferenceCores(t *testing.T) {
6262
srv := commands.NewArduinoCoreServer("")
6363
ctx := context.Background()
6464
for _, tt := range goodCores {
65-
actual, err := arguments.ParseReference(srv, ctx, tt.in)
65+
actual, err := arguments.ParseReference(ctx, srv, tt.in)
6666
assert.Nil(t, err)
6767
assert.Equal(t, tt.expected, actual)
6868
}
6969

7070
for _, tt := range badCores {
71-
actual, err := arguments.ParseReference(srv, ctx, tt.in)
71+
actual, err := arguments.ParseReference(ctx, srv, tt.in)
7272
require.NotNil(t, err, "Testing bad core '%s'", tt.in)
7373
require.Equal(t, tt.expected, actual, "Testing bad core '%s'", tt.in)
7474
}
@@ -81,7 +81,7 @@ func TestParseArgs(t *testing.T) {
8181
}
8282

8383
srv := commands.NewArduinoCoreServer("")
84-
refs, err := arguments.ParseReferences(srv, context.Background(), input)
84+
refs, err := arguments.ParseReferences(context.Background(), srv, input)
8585
assert.Nil(t, err)
8686
assert.Equal(t, len(goodCores), len(refs))
8787

Diff for: internal/cli/board/details.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ func initDetailsCommand(srv rpc.ArduinoCoreServiceServer) *cobra.Command {
5757

5858
func runDetailsCommand(srv rpc.ArduinoCoreServiceServer, fqbn string, showFullDetails, listProgrammers bool, showProperties arguments.ShowProperties) {
5959
ctx := context.Background()
60-
inst := instance.CreateAndInit(srv, ctx)
60+
inst := instance.CreateAndInit(ctx, srv)
6161

6262
logrus.Info("Executing `arduino-cli board details`")
6363

Diff for: internal/cli/board/list.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ func initListCommand(srv rpc.ArduinoCoreServiceServer) *cobra.Command {
5959
// runListCommand detects and lists the connected arduino boards
6060
func runListCommand(srv rpc.ArduinoCoreServiceServer, watch bool, timeout int64, fqbn string) {
6161
ctx := context.Background()
62-
inst := instance.CreateAndInit(srv, ctx)
62+
inst := instance.CreateAndInit(ctx, srv)
6363

6464
logrus.Info("Executing `arduino-cli board list`")
6565

Diff for: internal/cli/board/listall.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ for a specific board if you specify the board name`),
5353
// runListAllCommand list all installed boards
5454
func runListAllCommand(args []string, srv rpc.ArduinoCoreServiceServer) {
5555
ctx := context.Background()
56-
inst := instance.CreateAndInit(srv, ctx)
56+
inst := instance.CreateAndInit(ctx, srv)
5757

5858
logrus.Info("Executing `arduino-cli board listall`")
5959

Diff for: internal/cli/board/search.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ func initSearchCommand(srv rpc.ArduinoCoreServiceServer) *cobra.Command {
5050

5151
func runSearchCommand(srv rpc.ArduinoCoreServiceServer, args []string) {
5252
ctx := context.Background()
53-
inst := instance.CreateAndInit(srv, ctx)
53+
inst := instance.CreateAndInit(ctx, srv)
5454

5555
logrus.Info("Executing `arduino-cli board search`")
5656

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ func NewCommand(srv rpc.ArduinoCoreServiceServer) *cobra.Command {
6767

6868
func runBootloaderCommand(srv rpc.ArduinoCoreServiceServer) {
6969
ctx := context.Background()
70-
instance := instance.CreateAndInit(srv, ctx)
70+
instance := instance.CreateAndInit(ctx, srv)
7171

7272
logrus.Info("Executing `arduino-cli burn-bootloader`")
7373

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,9 @@ func runCompileCommand(cmd *cobra.Command, args []string, srv rpc.ArduinoCoreSer
171171
var profile *rpc.SketchProfile
172172

173173
if profileArg.Get() == "" {
174-
inst, profile = instance.CreateAndInitWithProfile(srv, ctx, sk.GetDefaultProfile().GetName(), sketchPath)
174+
inst, profile = instance.CreateAndInitWithProfile(ctx, srv, sk.GetDefaultProfile().GetName(), sketchPath)
175175
} else {
176-
inst, profile = instance.CreateAndInitWithProfile(srv, ctx, profileArg.Get(), sketchPath)
176+
inst, profile = instance.CreateAndInitWithProfile(ctx, srv, profileArg.Get(), sketchPath)
177177
}
178178

179179
if fqbnArg.String() == "" {

Diff for: internal/cli/core/download.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -42,19 +42,19 @@ func initDownloadCommand(srv rpc.ArduinoCoreServiceServer) *cobra.Command {
4242
runDownloadCommand(srv, args)
4343
},
4444
ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
45-
return arguments.GetInstallableCores(srv, context.Background()), cobra.ShellCompDirectiveDefault
45+
return arguments.GetInstallableCores(context.Background(), srv), cobra.ShellCompDirectiveDefault
4646
},
4747
}
4848
return downloadCommand
4949
}
5050

5151
func runDownloadCommand(srv rpc.ArduinoCoreServiceServer, args []string) {
5252
ctx := context.Background()
53-
inst := instance.CreateAndInit(srv, ctx)
53+
inst := instance.CreateAndInit(ctx, srv)
5454

5555
logrus.Info("Executing `arduino-cli core download`")
5656

57-
platformsRefs, err := arguments.ParseReferences(srv, ctx, args)
57+
platformsRefs, err := arguments.ParseReferences(ctx, srv, args)
5858
if err != nil {
5959
feedback.Fatal(tr("Invalid argument passed: %v", err), feedback.ErrBadArgument)
6060
}

Diff for: internal/cli/core/install.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ func initInstallCommand(srv rpc.ArduinoCoreServiceServer) *cobra.Command {
4848
runInstallCommand(srv, args, scriptFlags, noOverwrite)
4949
},
5050
ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
51-
return arguments.GetInstallableCores(srv, context.Background()), cobra.ShellCompDirectiveDefault
51+
return arguments.GetInstallableCores(context.Background(), srv), cobra.ShellCompDirectiveDefault
5252
},
5353
}
5454
scriptFlags.AddToCommand(installCommand)
@@ -59,9 +59,9 @@ func initInstallCommand(srv rpc.ArduinoCoreServiceServer) *cobra.Command {
5959
func runInstallCommand(srv rpc.ArduinoCoreServiceServer, args []string, scriptFlags arguments.PrePostScriptsFlags, noOverwrite bool) {
6060
logrus.Info("Executing `arduino-cli core install`")
6161
ctx := context.Background()
62-
inst := instance.CreateAndInit(srv, ctx)
62+
inst := instance.CreateAndInit(ctx, srv)
6363

64-
platformsRefs, err := arguments.ParseReferences(srv, ctx, args)
64+
platformsRefs, err := arguments.ParseReferences(ctx, srv, args)
6565
if err != nil {
6666
feedback.Fatal(tr("Invalid argument passed: %v", err), feedback.ErrBadArgument)
6767
}

Diff for: internal/cli/core/list.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func initListCommand(srv rpc.ArduinoCoreServiceServer) *cobra.Command {
4949

5050
func runListCommand(srv rpc.ArduinoCoreServiceServer, all bool, updatableOnly bool) {
5151
ctx := context.Background()
52-
inst := instance.CreateAndInit(srv, ctx)
52+
inst := instance.CreateAndInit(ctx, srv)
5353
logrus.Info("Executing `arduino-cli core list`")
5454
List(inst, all, updatableOnly)
5555
}

Diff for: internal/cli/core/search.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ const indexUpdateInterval = "24h"
5858

5959
func runSearchCommand(srv rpc.ArduinoCoreServiceServer, args []string, allVersions bool) {
6060
ctx := context.Background()
61-
inst := instance.CreateAndInit(srv, ctx)
61+
inst := instance.CreateAndInit(ctx, srv)
6262

6363
if indexesNeedUpdating(indexUpdateInterval) {
6464
err := commands.UpdateIndex(context.Background(), &rpc.UpdateIndexRequest{Instance: inst}, feedback.ProgressBar())

Diff for: internal/cli/core/uninstall.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ func initUninstallCommand(srv rpc.ArduinoCoreServiceServer) *cobra.Command {
4141
runUninstallCommand(srv, args, preUninstallFlags)
4242
},
4343
ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
44-
return arguments.GetUninstallableCores(srv, context.Background()), cobra.ShellCompDirectiveDefault
44+
return arguments.GetUninstallableCores(context.Background(), srv), cobra.ShellCompDirectiveDefault
4545
},
4646
}
4747
preUninstallFlags.AddToCommand(uninstallCommand)
@@ -51,9 +51,9 @@ func initUninstallCommand(srv rpc.ArduinoCoreServiceServer) *cobra.Command {
5151
func runUninstallCommand(srv rpc.ArduinoCoreServiceServer, args []string, preUninstallFlags arguments.PrePostScriptsFlags) {
5252
logrus.Info("Executing `arduino-cli core uninstall`")
5353
ctx := context.Background()
54-
inst := instance.CreateAndInit(srv, ctx)
54+
inst := instance.CreateAndInit(ctx, srv)
5555

56-
platformsRefs, err := arguments.ParseReferences(srv, ctx, args)
56+
platformsRefs, err := arguments.ParseReferences(ctx, srv, args)
5757
if err != nil {
5858
feedback.Fatal(tr("Invalid argument passed: %v", err), feedback.ErrBadArgument)
5959
}

Diff for: internal/cli/core/update_index.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ func initUpdateIndexCommand(srv rpc.ArduinoCoreServiceServer) *cobra.Command {
4444
func runUpdateIndexCommand(srv rpc.ArduinoCoreServiceServer) {
4545
logrus.Info("Executing `arduino-cli core update-index`")
4646
ctx := context.Background()
47-
inst := instance.CreateAndInit(srv, ctx)
47+
inst := instance.CreateAndInit(ctx, srv)
4848

4949
UpdateIndex(inst)
5050
}

Diff for: internal/cli/core/upgrade.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,12 @@ func initUpgradeCommand(srv rpc.ArduinoCoreServiceServer) *cobra.Command {
5353
func runUpgradeCommand(srv rpc.ArduinoCoreServiceServer, args []string, skipPostInstall bool, skipPreUninstall bool) {
5454
logrus.Info("Executing `arduino-cli core upgrade`")
5555
ctx := context.Background()
56-
inst := instance.CreateAndInit(srv, ctx)
57-
Upgrade(srv, ctx, inst, args, skipPostInstall, skipPreUninstall)
56+
inst := instance.CreateAndInit(ctx, srv)
57+
Upgrade(ctx, srv, inst, args, skipPostInstall, skipPreUninstall)
5858
}
5959

6060
// Upgrade upgrades one or all installed platforms to the latest version.
61-
func Upgrade(srv rpc.ArduinoCoreServiceServer, ctx context.Context, inst *rpc.Instance, args []string, skipPostInstall bool, skipPreUninstall bool) {
61+
func Upgrade(ctx context.Context, srv rpc.ArduinoCoreServiceServer, inst *rpc.Instance, args []string, skipPostInstall bool, skipPreUninstall bool) {
6262
// if no platform was passed, upgrade allthethings
6363
if len(args) == 0 {
6464
platforms, err := commands.PlatformSearch(&rpc.PlatformSearchRequest{
@@ -103,7 +103,7 @@ func Upgrade(srv rpc.ArduinoCoreServiceServer, ctx context.Context, inst *rpc.In
103103
}
104104

105105
// proceed upgrading, if anything is upgradable
106-
platformsRefs, err := arguments.ParseReferences(srv, ctx, args)
106+
platformsRefs, err := arguments.ParseReferences(ctx, srv, args)
107107
if err != nil {
108108
feedback.Fatal(tr("Invalid argument passed: %v", err), feedback.ErrBadArgument)
109109
}

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,9 @@ func runDebugCommand(srv rpc.ArduinoCoreServiceServer, args []string, portArgs *
9393
var profile *rpc.SketchProfile
9494

9595
if profileArg.Get() == "" {
96-
inst, profile = instance.CreateAndInitWithProfile(srv, ctx, sk.GetDefaultProfile().GetName(), sketchPath)
96+
inst, profile = instance.CreateAndInitWithProfile(ctx, srv, sk.GetDefaultProfile().GetName(), sketchPath)
9797
} else {
98-
inst, profile = instance.CreateAndInitWithProfile(srv, ctx, profileArg.Get(), sketchPath)
98+
inst, profile = instance.CreateAndInitWithProfile(ctx, srv, profileArg.Get(), sketchPath)
9999
}
100100

101101
if fqbnArg.String() == "" {

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ func newDebugCheckCommand(srv rpc.ArduinoCoreServiceServer) *cobra.Command {
5353

5454
func runDebugCheckCommand(srv rpc.ArduinoCoreServiceServer, portArgs *arguments.Port, fqbnArg *arguments.Fqbn, interpreter string, programmerArg *arguments.Programmer) {
5555
ctx := context.Background()
56-
instance := instance.CreateAndInit(srv, ctx)
56+
instance := instance.CreateAndInit(ctx, srv)
5757
logrus.Info("Executing `arduino-cli debug`")
5858

5959
port, err := portArgs.GetPort(instance, srv, "", "")

0 commit comments

Comments
 (0)