Skip to content

Commit 8f65d3a

Browse files
committed
Let instance commands require an *rpc.Instance
Removed the shorthand of the InstanceCommand interface. This makes the API more coherent among the `commands` instance handling.
1 parent 1e51cdc commit 8f65d3a

29 files changed

+41
-47
lines changed

commands/board/details.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import (
2828
// Details returns all details for a board including tools and HW identifiers.
2929
// This command basically gather al the information and translates it into the required grpc struct properties
3030
func Details(ctx context.Context, req *rpc.BoardDetailsRequest) (*rpc.BoardDetailsResponse, error) {
31-
pme, release := commands.GetPackageManagerExplorer(req)
31+
pme, release := commands.GetPackageManagerExplorer(req.GetInstance())
3232
if pme == nil {
3333
return nil, &arduino.InvalidInstanceError{}
3434
}

commands/board/list.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ func identify(pme *packagemanager.Explorer, port *discovery.Port) ([]*rpc.BoardL
203203
// In case of errors partial results from discoveries that didn't fail
204204
// are returned.
205205
func List(req *rpc.BoardListRequest) (r []*rpc.DetectedPort, discoveryStartErrors []error, e error) {
206-
pme, release := commands.GetPackageManagerExplorer(req)
206+
pme, release := commands.GetPackageManagerExplorer(req.GetInstance())
207207
if pme == nil {
208208
return nil, nil, &arduino.InvalidInstanceError{}
209209
}
@@ -258,7 +258,7 @@ func hasMatchingBoard(b *rpc.DetectedPort, fqbnFilter *cores.FQBN) bool {
258258

259259
// Watch returns a channel that receives boards connection and disconnection events.
260260
func Watch(ctx context.Context, req *rpc.BoardListWatchRequest) (<-chan *rpc.BoardListWatchResponse, error) {
261-
pme, release := commands.GetPackageManagerExplorer(req)
261+
pme, release := commands.GetPackageManagerExplorer(req.GetInstance())
262262
if pme == nil {
263263
return nil, &arduino.InvalidInstanceError{}
264264
}

commands/board/listall.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import (
2929

3030
// ListAll FIXMEDOC
3131
func ListAll(ctx context.Context, req *rpc.BoardListAllRequest) (*rpc.BoardListAllResponse, error) {
32-
pme, release := commands.GetPackageManagerExplorer(req)
32+
pme, release := commands.GetPackageManagerExplorer(req.GetInstance())
3333
if pme == nil {
3434
return nil, &arduino.InvalidInstanceError{}
3535
}

commands/board/search.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import (
3131
// installed. Note that platforms that are not installed don't include boards' FQBNs.
3232
// If no search argument is used all boards are returned.
3333
func Search(ctx context.Context, req *rpc.BoardSearchRequest) (*rpc.BoardSearchResponse, error) {
34-
pme, release := commands.GetPackageManagerExplorer(req)
34+
pme, release := commands.GetPackageManagerExplorer(req.GetInstance())
3535
if pme == nil {
3636
return nil, &arduino.InvalidInstanceError{}
3737
}

commands/compile/compile.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,13 @@ func Compile(ctx context.Context, req *rpc.CompileRequest, outStream, errStream
5757
exportBinaries = reqExportBinaries.Value
5858
}
5959

60-
pme, release := commands.GetPackageManagerExplorer(req)
60+
pme, release := commands.GetPackageManagerExplorer(req.GetInstance())
6161
if pme == nil {
6262
return nil, &arduino.InvalidInstanceError{}
6363
}
6464
defer release()
6565

66-
lm := commands.GetLibraryManager(req)
66+
lm := commands.GetLibraryManager(req.GetInstance())
6767
if lm == nil {
6868
return nil, &arduino.InvalidInstanceError{}
6969
}

commands/core/download.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ var tr = i18n.Tr
2929

3030
// PlatformDownload FIXMEDOC
3131
func PlatformDownload(ctx context.Context, req *rpc.PlatformDownloadRequest, downloadCB rpc.DownloadProgressCB) (*rpc.PlatformDownloadResponse, error) {
32-
pme, release := commands.GetPackageManagerExplorer(req)
32+
pme, release := commands.GetPackageManagerExplorer(req.GetInstance())
3333
if pme == nil {
3434
return nil, &arduino.InvalidInstanceError{}
3535
}

commands/core/install.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import (
2828
// PlatformInstall FIXMEDOC
2929
func PlatformInstall(ctx context.Context, req *rpc.PlatformInstallRequest, downloadCB rpc.DownloadProgressCB, taskCB rpc.TaskProgressCB) (*rpc.PlatformInstallResponse, error) {
3030
install := func() error {
31-
pme, release := commands.GetPackageManagerExplorer(req)
31+
pme, release := commands.GetPackageManagerExplorer(req.GetInstance())
3232
if pme == nil {
3333
return &arduino.InvalidInstanceError{}
3434
}

commands/core/list.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import (
2828
// PlatformList returns a list of installed platforms, optionally filtered by
2929
// those requiring an update.
3030
func PlatformList(req *rpc.PlatformListRequest) (*rpc.PlatformListResponse, error) {
31-
pme, release := commands.GetPackageManagerExplorer(req)
31+
pme, release := commands.GetPackageManagerExplorer(req.GetInstance())
3232
if pme == nil {
3333
return nil, &arduino.InvalidInstanceError{}
3434
}

commands/core/search.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import (
2929

3030
// PlatformSearch FIXMEDOC
3131
func PlatformSearch(req *rpc.PlatformSearchRequest) (*rpc.PlatformSearchResponse, error) {
32-
pme, release := commands.GetPackageManagerExplorer(req)
32+
pme, release := commands.GetPackageManagerExplorer(req.GetInstance())
3333
if pme == nil {
3434
return nil, &arduino.InvalidInstanceError{}
3535
}

commands/core/uninstall.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func PlatformUninstall(ctx context.Context, req *rpc.PlatformUninstallRequest, t
3737

3838
// platformUninstall is the implementation of platform unistaller
3939
func platformUninstall(ctx context.Context, req *rpc.PlatformUninstallRequest, taskCB rpc.TaskProgressCB) error {
40-
pme, release := commands.GetPackageManagerExplorer(req)
40+
pme, release := commands.GetPackageManagerExplorer(req.GetInstance())
4141
if pme == nil {
4242
return &arduino.InvalidInstanceError{}
4343
}

0 commit comments

Comments
 (0)