Skip to content

Commit

Permalink
Use ListProgrammersAvailableForUpload function call to avoid accessin…
Browse files Browse the repository at this point in the history
…g arduino/cores package directly
  • Loading branch information
MatteoPologruto committed Aug 30, 2023
1 parent 3f9373a commit e244d17
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 e244d17

Please sign in to comment.