8000 add dynamic completion by umbynos · Pull Request #1509 · arduino/arduino-cli · GitHub
[go: up one dir, main page]

Skip to content

add dynamic completion #1509

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 22 commits into from
Oct 18, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
9d61a6e
add completion for `-b` or `--fqbn` for every command
umbynos Oct 18, 2021
b7263bf
add completion for `-l` or `--protocol`
umbynos Oct 18, 2021
b6ed62f
the previous implementation was working only with a board connected t…
umbynos Oct 5, 2021
3e57b18
add static completion for `--log-level, `--log-format` and `--format`
umbynos Oct 6, 2021
0c0823f
add completion for `-P` or `--programmer` & fix typo
umbynos Oct 6, 2021
fe4ab51
add completion for `core uninstall`
umbynos Oct 6, 2021
fc82c12
add completion for `core install` and `core download`
umbynos Oct 6, 2021
e79ae01
add completion for `lib uninstall`
umbynos Oct 6, 2021
6d560b2
add completion for `lib install`, `lib download`
umbynos Oct 7, 2021
3486d94
add completion for `lib examples`
umbynos Oct 7, 2021
28dfdc1
add completion for `config add`, `config remove`, `config delete` and…
umbynos Oct 7, 2021
27d300c
add completion for `lib deps`
umbynos Oct 7, 2021
d7be814
add tests
umbynos Oct 12, 2021
4559c25
enhance the completion for `config add` and `config remove`
umbynos Oct 13, 2021
6b1a01c
add description completion suggestion for core, lib, fqbn, programmer
umbynos Oct 13, 2021
5462031
add completion also for `-p` or `--port` flag
umbynos Oct 13, 2021
fe2cf65
remove the `toComplete` parameter from all the completion functions
umbynos Oct 13, 2021
2a953a9
fixes after rebase
umbynos Oct 13, 2021
7235896
update docs
umbynos Oct 13, 2021
d6c4732
add `-b` or `--fqbn` completion for the monitor command and tests
umbynos Oct 14, 2021
c5ee4d0
apply suggestions from code review
umbynos Oct 15, 2021
d6d4502
fixes after rebase
umbynos Oct 18, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add -b or --fqbn completion for the monitor command and tests
  • Loading branch information
umbynos committed Oct 18, 2021
commit d6c4732a18426d4715d9d29a8f19cc397713484e
3 changes: 3 additions & 0 deletions cli/monitor/monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ func NewCommand() *cobra.Command {
cmd.Flags().StringSliceVarP(&configs, "config", "c", []string{}, tr("Configuration of the port."))
cmd.Flags().BoolVarP(&quiet, "quiet", "q", false, tr("Run in silent mode, show only monitor input and output."))
cmd.Flags().StringVarP(&fqbn, "fqbn", "b", "", tr("Fully Qualified Board Name, e.g.: arduino:avr:uno"))
cmd.RegisterFlagCompletionFunc("fqbn", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
return arguments.GetInstalledBoards(), cobra.ShellCompDirectiveDefault
})
cmd.MarkFlagRequired("port")
return cmd
}
Expand Down
22 changes: 11 additions & 11 deletions i18n/data/en.po
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ msgstr "Configuring platform."
msgid "Connected"
msgstr "Connected"

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

Expand Down Expand Up @@ -504,7 +504,7 @@ msgstr "Debugging not supported for board %s"
msgid "Debugging supported:"
msgstr "Debugging supported:"

#: cli/monitor/monitor.go:192
#: cli/monitor/monitor.go:195
msgid "Default"
msgstr "Default"

Expand Down Expand Up @@ -790,7 +790,7 @@ msgstr "Error getting information for library %s"
msgid "Error getting libraries info: %v"
msgstr "Error getting libraries info: %v"

#: cli/monitor/monitor.go:87
#: cli/monitor/monitor.go:90
msgid "Error getting port settings details: %s"
msgstr "Error getting port settings details: %s"

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

#: cli/core/list.go:84
#: cli/core/search.go:114
#: cli/monitor/monitor.go:192
#: cli/monitor/monitor.go:195
#: cli/outdated/outdated.go:62
msgid "ID"
msgstr "ID"
Expand Down Expand Up @@ -1480,7 +1480,7 @@ msgstr "Missing sketch path"
msgid "Monitor '%s' not found"
msgstr "Monitor '%s' not found"

#: cli/monitor/monitor.go:140
#: cli/monitor/monitor.go:143
msgid "Monitor port settings:"
msgstr "Monitor port settings:"

Expand Down Expand Up @@ -1736,8 +1736,8 @@ msgstr "Platform size (bytes):"
msgid "Port"
msgstr "Port"

#: cli/monitor/monitor.go:161
#: cli/monitor/monitor.go:168
#: cli/monitor/monitor.go:164
#: cli/monitor/monitor.go:171
msgid "Port closed:"
msgstr "Port closed:"

Expand Down Expand Up @@ -1878,7 +1878,7 @@ msgstr "Sets a setting value."
msgid "Sets where to save the configuration file."
msgstr "Sets where to save the configuration file."

#: cli/monitor/monitor.go:192
#: cli/monitor/monitor.go:195
msgid "Setting"
msgstr "Setting"

Expand Down Expand Up @@ -2353,7 +2353,7 @@ msgstr "VERSION"
msgid "VERSION_NUMBER"
msgstr "VERSION_NUMBER"

#: cli/monitor/monitor.go:192
#: cli/monitor/monitor.go:195
msgid "Values"
msgstr "Values"

Expand Down Expand Up @@ -2860,11 +2860,11 @@ msgstr "invalid platform archive size: %s"
msgid "invalid pluggable monitor reference: %s"
msgstr "invalid pluggable monitor reference: %s"

#: cli/monitor/monitor.go:123
#: cli/monitor/monitor.go:126
msgid "invalid port configuration value for %s: %s"
msgstr "invalid port configuration value for %s: %s"

#: cli/monitor/monitor.go:132
#: cli/monitor/monitor.go:135
msgid "invalid port configuration: %s"
msgstr "invalid port configuration: %s"

Expand Down
4 changes: 4 additions & 0 deletions test/test_completion.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,8 @@ def test_core_completion(run_command):
assert "arduino:avr:uno" in result.stdout
result = run_command(["__complete", "upload", "-b", ""])
assert "arduino:avr:uno" in result.stdout
result = run_command(["__complete", "monitor", "-b", ""])
assert "arduino:avr:uno" in result.stdout
result = run_command(["__complete", "burn-bootloader", "-l", ""])
assert "network" in result.stdout
result = run_command(["__complete", "compile", "-l", ""])
Expand All @@ -187,6 +189,8 @@ def test_core_completion(run_command):
assert "network" in result.stdout
result = run_command(["__complete", "upload", "-l", ""])
assert "network" in result.stdout
result = run_command(["__complete", "monitor", "-l", ""])
assert "network" in result.stdout
result = run_command(["__complete", "burn-bootloader", "-P", ""])
assert "atmel_ice" in result.stdout
result = run_command(["__complete", "compile", "-P", ""])
Expand Down
0