From 9dede8aeb89ffe51f75562724625c4c0549320a1 Mon Sep 17 00:00:00 2001 From: MatteoPologruto <109663225+MatteoPologruto@users.noreply.github.com> Date: Wed, 6 Sep 2023 11:15:41 +0200 Subject: [PATCH] [skip-changelog] Use gRPC function call to avoid accessing `arduino/cores` package directly (#2292) --- internal/cli/arguments/completion.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/internal/cli/arguments/completion.go b/internal/cli/arguments/completion.go index f3348899785..5b25b2773bc 100644 --- a/internal/cli/arguments/completion.go +++ b/internal/cli/arguments/completion.go @@ -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" ) @@ -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() } }