Skip to content

Commit 72463d5

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

File tree

4 files changed

+22
-15
lines changed

4 files changed

+22
-15
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: i18n/data/en.po

+11-11
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ msgstr "Configuring platform."
427427
msgid "Connected"
428428
msgstr "Connected"
429429

430-
#: cli/monitor/monitor.go:174
430+
#: cli/monitor/monitor.go:177
431431
msgid "Connected to %s! Press CTRL-C to exit."
432432
msgstr "Connected to %s! Press CTRL-C to exit."
433433

@@ -504,7 +504,7 @@ msgstr "Debugging not supported for board %s"
504504
msgid "Debugging supported:"
505505
msgstr "Debugging supported:"
506506

507-
#: cli/monitor/monitor.go:192
507+
#: cli/monitor/monitor.go:195
508508
msgid "Default"
509509
msgstr "Default"
510510

@@ -790,7 +790,7 @@ msgstr "Error getting information for library %s"
790790
msgid "Error getting libraries info: %v"
791791
msgstr "Error getting libraries info: %v"
792792

793-
#: cli/monitor/monitor.go:87
793+
#: cli/monitor/monitor.go:90
794794
msgid "Error getting port settings details: %s"
795795
msgstr "Error getting port settings details: %s"
796796

@@ -1139,7 +1139,7 @@ msgstr "Global variables use {0} bytes of dynamic memory."
11391139

11401140
#: cli/core/list.go:84
11411141
#: cli/core/search.go:114
1142-
#: cli/monitor/monitor.go:192
1142+
#: cli/monitor/monitor.go:195
11431143
#: cli/outdated/outdated.go:62
11441144
msgid "ID"
11451145
msgstr "ID"
@@ -1480,7 +1480,7 @@ msgstr "Missing sketch path"
14801480
msgid "Monitor '%s' not found"
14811481
msgstr "Monitor '%s' not found"
14821482

1483-
#: cli/monitor/monitor.go:140
1483+
#: cli/monitor/monitor.go:143
14841484
msgid "Monitor port settings:"
14851485
msgstr "Monitor port settings:"
14861486

@@ -1736,8 +1736,8 @@ msgstr "Platform size (bytes):"
17361736
msgid "Port"
17371737
msgstr "Port"
17381738

1739-
#: cli/monitor/monitor.go:161
1740-
#: cli/monitor/monitor.go:168
1739+
#: cli/monitor/monitor.go:164
1740+
#: cli/monitor/monitor.go:171
17411741
msgid "Port closed:"
17421742
msgstr "Port closed:"
17431743

@@ -1878,7 +1878,7 @@ msgstr "Sets a setting value."
18781878
msgid "Sets where to save the configuration file."
18791879
msgstr "Sets where to save the configuration file."
18801880

1881-
#: cli/monitor/monitor.go:192
1881+
#: cli/monitor/monitor.go:195
18821882
msgid "Setting"
18831883
msgstr "Setting"
18841884

@@ -2353,7 +2353,7 @@ msgstr "VERSION"
23532353
msgid "VERSION_NUMBER"
23542354
msgstr "VERSION_NUMBER"
23552355

2356-
#: cli/monitor/monitor.go:192
2356+
#: cli/monitor/monitor.go:195
23572357
msgid "Values"
23582358
msgstr "Values"
23592359

@@ -2860,11 +2860,11 @@ msgstr "invalid platform archive size: %s"
28602860
msgid "invalid pluggable monitor reference: %s"
28612861
msgstr "invalid pluggable monitor reference: %s"
28622862

2863-
#: cli/monitor/monitor.go:123
2863+
#: cli/monitor/monitor.go:126
28642864
msgid "invalid port configuration value for %s: %s"
28652865
msgstr "invalid port configuration value for %s: %s"
28662866

2867-
#: cli/monitor/monitor.go:132
2867+
#: cli/monitor/monitor.go:135
28682868
msgid "invalid port configuration: %s"
28692869
msgstr "invalid port configuration: %s"
28702870

Diff for: i18n/rice-box.go

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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)