Skip to content

Commit

Permalink
[skip-changelog] Use gRPC function call to avoid accessing `arduino/c…
Browse files Browse the repository at this point in the history
…ores` package directly (#2292)
  • Loading branch information
MatteoPologruto authored Sep 6, 2023
1 parent d5c83ad commit 9dede8a
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions internal/cli/arguments/completion.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ package arguments
import (
"context"

"github.com/arduino/arduino-cli/arduino/cores"
"github.com/arduino/arduino-cli/commands"
"github.com/arduino/arduino-cli/commands/board"
"github.com/arduino/arduino-cli/commands/core"
"github.com/arduino/arduino-cli/commands/lib"
"github.com/arduino/arduino-cli/commands/upload"
"github.com/arduino/arduino-cli/internal/cli/instance"
rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1"
)
Expand Down Expand Up @@ -103,10 +103,12 @@ func GetInstalledProgrammers() []string {

installedProgrammers := make(map[string]string)
for _, board := range list.Boards {
fqbn, _ := cores.ParseFQBN(board.Fqbn)
_, boardPlatform, _, _, _, _ := pme.ResolveFQBN(fqbn)
for programmerID, programmer := range boardPlatform.Programmers {
installedProgrammers[programmerID] = programmer.Name
programmers, _ := upload.ListProgrammersAvailableForUpload(context.Background(), &rpc.ListProgrammersAvailableForUploadRequest{
Instance: inst,
Fqbn: board.Fqbn,
})
for _, programmer := range programmers.GetProgrammers() {
installedProgrammers[programmer.GetId()] = programmer.GetName()
}
}

Expand Down

0 comments on commit 9dede8a

Please sign in to comment.