Skip to content

Commit 694560d

Browse files
committed
add -b or --fqbn completion for the monitor command and tests
1 parent 042eb2f commit 694560d

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

Diff for: cli/monitor/monitor.go

+3
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ func NewCommand() *cobra.Command {
6161
cmd.Flags().StringSliceVarP(&configs, "config", "c", []string{}, tr("Configuration of the port."))
6262
cmd.Flags().BoolVarP(&quiet, "quiet", "q", false, tr("Run in silent mode, show only monitor input and output."))
6363
cmd.Flags().StringVarP(&fqbn, "fqbn", "b", "", tr("Fully Qualified Board Name, e.g.: arduino:avr:uno"))
64+
cmd.RegisterFlagCompletionFunc("fqbn", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
65+
return arguments.GetInstalledBoards(), cobra.ShellCompDirectiveDefault
66+
})
6467
cmd.MarkFlagRequired("port")
6568
return cmd
6669
}

Diff for: test/test_completion.py

+4
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,8 @@ def test_core_completion(run_command):
179179
assert "arduino:avr:uno" in result.stdout
180180
result = run_command(["__complete", "upload", "-b", ""])
181181
assert "arduino:avr:uno" in result.stdout
182+
result = run_command(["__complete", "monitor", "-b", ""])
183+
assert "arduino:avr:uno" in result.stdout
182184
result = run_command(["__complete", "burn-bootloader", "-l", ""])
183185
assert "network" in result.stdout
184186
result = run_command(["__complete", "compile", "-l", ""])
@@ -187,6 +189,8 @@ def test_core_completion(run_command):
187189
assert "network" in result.stdout
188190
result = run_command(["__complete", "upload", "-l", ""])
189191
assert "network" in result.stdout
192+
result = run_command(["__complete", "monitor", "-l", ""])
193+
assert "network" in result.stdout
190194
result = run_command(["__complete", "burn-bootloader", "-P", ""])
191195
assert "atmel_ice" in result.stdout
192196
result = run_command(["__complete", "compile", "-P", ""])

0 commit comments

Comments
 (0)