Skip to content

Commit 394fab7

Browse files
committed
uniform the usage of vars in burn-bootloader command & refactor fqbn
1 parent e1d2c0b commit 394fab7

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

cli/burnbootloader/burnbootloader.go

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import (
3030
)
3131

3232
var (
33-
fqbn string
33+
fqbn arguments.Fqbn
3434
port arguments.Port
3535
verbose bool
3636
verify bool
@@ -50,10 +50,7 @@ func NewCommand() *cobra.Command {
5050
Run: run,
5151
}
5252

53-
burnBootloaderCommand.Flags().StringVarP(&fqbn, "fqbn", "b", "", tr("Fully Qualified Board Name, e.g.: arduino:avr:uno"))
54-
burnBootloaderCommand.RegisterFlagCompletionFunc("fqbn", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
55-
return arguments.GetInstalledBoards(), cobra.ShellCompDirectiveDefault
56-
})
53+
fqbn.AddToCommand(burnBootloaderCommand)
5754
port.AddToCommand(burnBootloaderCommand)
5855
burnBootloaderCommand.Flags().BoolVarP(&verify, "verify", "t", false, tr("Verify uploaded binary after the upload."))
5956
burnBootloaderCommand.Flags().BoolVarP(&verbose, "verbose", "v", false, tr("Turns on verbose mode."))
@@ -79,7 +76,7 @@ func run(command *cobra.Command, args []string) {
7976

8077
if _, err := upload.BurnBootloader(context.Background(), &rpc.BurnBootloaderRequest{
8178
Instance: instance,
82-
Fqbn: fqbn,
79+
Fqbn: fqbn.String(),
8380
Port: discoveryPort.ToRPC(),
8481
Verbose: verbose,
8582
Verify: verify,

0 commit comments

Comments
 (0)