From 9d61a6eac559432203e9fd9fa40ec47c15f076f5 Mon Sep 17 00:00:00 2001 From: Umberto Baldi Date: Mon, 18 Oct 2021 14:13:26 +0200 Subject: [PATCH 01/22] add completion for `-b` or `--fqbn` for every command --- cli/arguments/completion.go | 28 ++ cli/board/details.go | 4 + cli/burnbootloader/burnbootloader.go | 3 + cli/compile/compile.go | 19 +- cli/debug/debug.go | 3 + cli/lib/examples.go | 4 + cli/upload/upload.go | 3 + i18n/data/en.po | 532 ++++++++++++--------------- 8 files changed, 272 insertions(+), 324 deletions(-) create mode 100644 cli/arguments/completion.go diff --git a/cli/arguments/completion.go b/cli/arguments/completion.go new file mode 100644 index 00000000000..327bb7d7941 --- /dev/null +++ b/cli/arguments/completion.go @@ -0,0 +1,28 @@ +package arguments + +import ( + "context" + + "github.com/arduino/arduino-cli/cli/instance" + "github.com/arduino/arduino-cli/commands/board" + rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1" +) + +// GetInstalledBoards is an helper function usefull to autocomplete. +// It returns a list of fqbn +// it's taken from cli/board/listall.go +func GetInstalledBoards(toComplete string) []string { + inst := instance.CreateAndInit() // TODO optimize this: it does not make sense to create an instance everytime + + list, _ := board.ListAll(context.Background(), &rpc.BoardListAllRequest{ + Instance: inst, + SearchArgs: nil, + IncludeHiddenBoards: false, + }) + var res []string + // transform the data structure for the completion + for _, i := range list.GetBoards() { + res = append(res, i.Fqbn) + } + return res +} diff --git a/cli/board/details.go b/cli/board/details.go index 87f9b975e4f..4ba75dcc451 100644 --- a/cli/board/details.go +++ b/cli/board/details.go @@ -20,6 +20,7 @@ import ( "fmt" "os" + "github.com/arduino/arduino-cli/cli/arguments" "github.com/arduino/arduino-cli/cli/errorcodes" "github.com/arduino/arduino-cli/cli/feedback" "github.com/arduino/arduino-cli/cli/instance" @@ -48,6 +49,9 @@ func initDetailsCommand() *cobra.Command { detailsCommand.Flags().BoolVarP(&showFullDetails, "full", "f", false, tr("Show full board details")) detailsCommand.Flags().StringVarP(&fqbn, "fqbn", "b", "", tr("Fully Qualified Board Name, e.g.: arduino:avr:uno")) + detailsCommand.RegisterFlagCompletionFunc("fqbn", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + return arguments.GetInstalledBoards(toComplete), cobra.ShellCompDirectiveDefault + }) detailsCommand.Flags().BoolVarP(&listProgrammers, "list-programmers", "", false, tr("Show list of available programmers")) // detailsCommand.MarkFlagRequired("fqbn") // enable once `board details ` is removed diff --git a/cli/burnbootloader/burnbootloader.go b/cli/burnbootloader/burnbootloader.go index 3eec262a659..3c3e2d820b7 100644 --- a/cli/burnbootloader/burnbootloader.go +++ b/cli/burnbootloader/burnbootloader.go @@ -51,6 +51,9 @@ func NewCommand() *cobra.Command { } burnBootloaderCommand.Flags().StringVarP(&fqbn, "fqbn", "b", "", tr("Fully Qualified Board Name, e.g.: arduino:avr:uno")) + burnBootloaderCommand.RegisterFlagCompletionFunc("fqbn", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + return arguments.GetInstalledBoards(toComplete), cobra.ShellCompDirectiveDefault + }) port.AddToCommand(burnBootloaderCommand) burnBootloaderCommand.Flags().BoolVarP(&verify, "verify", "t", false, tr("Verify uploaded binary after the upload.")) burnBootloaderCommand.Flags().BoolVarP(&verbose, "verbose", "v", false, tr("Turns on verbose mode.")) diff --git a/cli/compile/compile.go b/cli/compile/compile.go index 2c8f26b5fba..9b4e0f9504e 100644 --- a/cli/compile/compile.go +++ b/cli/compile/compile.go @@ -31,7 +31,6 @@ import ( "github.com/arduino/arduino-cli/cli/errorcodes" "github.com/arduino/arduino-cli/cli/instance" - "github.com/arduino/arduino-cli/commands/board" "github.com/arduino/arduino-cli/commands/compile" "github.com/arduino/arduino-cli/commands/upload" rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1" @@ -84,7 +83,7 @@ func NewCommand() *cobra.Command { command.Flags().StringVarP(&fqbn, "fqbn", "b", "", tr("Fully Qualified Board Name, e.g.: arduino:avr:uno")) command.RegisterFlagCompletionFunc("fqbn", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - return getBoards(toComplete), cobra.ShellCompDirectiveDefault + return arguments.GetInstalledBoards(toComplete), cobra.ShellCompDirectiveDefault }) command.Flags().BoolVar(&showProperties, "show-properties", false, tr("Show all build properties used instead of compiling.")) command.Flags().BoolVar(&preprocess, "preprocess", false, tr("Print preprocessed code to stdout instead of compiling.")) @@ -276,19 +275,3 @@ func (r *compileResult) String() string { // The output is already printed via os.Stdout/os.Stdin return "" } - -func getBoards(toComplete string) []string { - // from listall.go TODO optimize - inst := instance.CreateAndInit() - - list, _ := board.ListAll(context.Background(), &rpc.BoardListAllRequest{ - Instance: inst, - SearchArgs: nil, - IncludeHiddenBoards: false, - }) - var res []string - for _, i := range list.GetBoards() { - res = append(res, i.Fqbn) - } - return res -} diff --git a/cli/debug/debug.go b/cli/debug/debug.go index b1be9760bc0..6ba4f45840c 100644 --- a/cli/debug/debug.go +++ b/cli/debug/debug.go @@ -59,6 +59,9 @@ func NewCommand() *cobra.Command { } debugCommand.Flags().StringVarP(&fqbn, "fqbn", "b", "", tr("Fully Qualified Board Name, e.g.: arduino:avr:uno")) + debugCommand.RegisterFlagCompletionFunc("fqbn", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + return arguments.GetInstalledBoards(toComplete), cobra.ShellCompDirectiveDefault + }) port.AddToCommand(debugCommand) debugCommand.Flags().StringVarP(&programmer, "programmer", "P", "", tr("Programmer to use for debugging")) debugCommand.Flags().StringVar(&interpreter, "interpreter", "console", tr("Debug interpreter e.g.: %s", "console, mi, mi1, mi2, mi3")) diff --git a/cli/lib/examples.go b/cli/lib/examples.go index 69c205b29c1..f35884cbc88 100644 --- a/cli/lib/examples.go +++ b/cli/lib/examples.go @@ -22,6 +22,7 @@ import ( "sort" "strings" + "github.com/arduino/arduino-cli/cli/arguments" "github.com/arduino/arduino-cli/cli/errorcodes" "github.com/arduino/arduino-cli/cli/feedback" "github.com/arduino/arduino-cli/cli/instance" @@ -43,6 +44,9 @@ func initExamplesCommand() *cobra.Command { Run: runExamplesCommand, } examplesCommand.Flags().StringVarP(&examplesFlags.fqbn, "fqbn", "b", "", tr("Show libraries for the specified board FQBN.")) + examplesCommand.RegisterFlagCompletionFunc("fqbn", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + return arguments.GetInstalledBoards(toComplete), cobra.ShellCompDirectiveDefault + }) return examplesCommand } diff --git a/cli/upload/upload.go b/cli/upload/upload.go index 27449de122a..c65545d0d93 100644 --- a/cli/upload/upload.go +++ b/cli/upload/upload.go @@ -55,6 +55,9 @@ func NewCommand() *cobra.Command { } uploadCommand.Flags().StringVarP(&fqbn, "fqbn", "b", "", tr("Fully Qualified Board Name, e.g.: arduino:avr:uno")) + uploadCommand.RegisterFlagCompletionFunc("fqbn", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + return arguments.GetInstalledBoards(toComplete), cobra.ShellCompDirectiveDefault + }) port.AddToCommand(uploadCommand) uploadCommand.Flags().StringVarP(&importDir, "input-dir", "", "", tr("Directory containing binaries to upload.")) uploadCommand.Flags().StringVarP(&importFile, "input-file", "i", "", tr("Binary file to upload.")) diff --git a/i18n/data/en.po b/i18n/data/en.po index c2c77175b40..fa879aa3a12 100644 --- a/i18n/data/en.po +++ b/i18n/data/en.po @@ -66,11 +66,11 @@ msgstr "%s must be installed." msgid "%s pattern is missing" msgstr "%s pattern is missing" -#: commands/instances.go:850 +#: commands/instances.go:839 msgid "%s uninstalled" msgstr "%s uninstalled" -#: commands/errors.go:671 +#: commands/errors.go:595 msgid "'%s' has an invalid signature" msgstr "'%s' has an invalid signature" @@ -95,7 +95,7 @@ msgstr "--git-url and --zip-path flags allow installing untrusted files, use it msgid "A new release of Arduino CLI is available:" msgstr "A new release of Arduino CLI is available:" -#: commands/errors.go:207 +#: commands/errors.go:181 msgid "A programmer is required to upload" msgstr "A programmer is required to upload" @@ -127,7 +127,7 @@ msgstr "Aliases:" msgid "All the cores are already at the latest version" msgstr "All the cores are already at the latest version" -#: commands/instances.go:719 +#: commands/instances.go:708 #: commands/lib/install.go:96 msgid "Already installed %s" msgstr "Already installed %s" @@ -153,11 +153,11 @@ msgstr "Archiving built core (caching) in: {0}" msgid "Arduino CLI sketch commands." msgstr "Arduino CLI sketch commands." -#: cli/cli.go:72 +#: cli/cli.go:71 msgid "Arduino CLI." msgstr "Arduino CLI." -#: cli/cli.go:73 +#: cli/cli.go:72 msgid "Arduino Command Line Interface (arduino-cli)." msgstr "Arduino Command Line Interface (arduino-cli)." @@ -212,7 +212,7 @@ msgstr "Available" msgid "Available Commands:" msgstr "Available Commands:" -#: cli/upload/upload.go:60 +#: cli/upload/upload.go:63 msgid "Binary file to upload." msgstr "Binary file to upload." @@ -227,11 +227,11 @@ msgstr "Board Name" msgid "Board found: %s" msgstr "Board found: %s" -#: cli/board/details.go:120 +#: cli/board/details.go:124 msgid "Board name:" msgstr "Board name:" -#: cli/board/details.go:122 +#: cli/board/details.go:126 msgid "Board version:" msgstr "Board version:" @@ -239,18 +239,14 @@ msgstr "Board version:" msgid "Bootloader file specified but missing: {0}" msgstr "Bootloader file specified but missing: {0}" -#: cli/compile/compile.go:91 +#: cli/compile/compile.go:90 msgid "Builds of 'core.a' are saved into this path to be cached and reused." msgstr "Builds of 'core.a' are saved into this path to be cached and reused." -#: commands/instances.go:532 +#: commands/instances.go:521 msgid "Can't create data directory %s" msgstr "Can't create data directory %s" -#: commands/errors.go:377 -msgid "Can't create sketch" -msgstr "Can't create sketch" - #: commands/lib/download.go:60 #: commands/lib/download.go:63 #: commands/lib/download.go:65 @@ -259,12 +255,12 @@ msgstr "Can't download library" #: commands/core/install.go:126 #: commands/core/uninstall.go:52 -#: commands/instances.go:758 -#: commands/instances.go:770 +#: commands/instances.go:747 +#: commands/instances.go:759 msgid "Can't find dependencies for platform %s" msgstr "Can't find dependencies for platform %s" -#: commands/errors.go:390 +#: commands/errors.go:332 msgid "Can't open sketch" msgstr "Can't open sketch" @@ -298,11 +294,11 @@ msgstr "Cannot create config file directory: %v" msgid "Cannot create config file: %v" msgstr "Cannot create config file: %v" -#: commands/errors.go:634 +#: commands/errors.go:558 msgid "Cannot create temp dir" msgstr "Cannot create temp dir" -#: commands/errors.go:652 +#: commands/errors.go:576 msgid "Cannot create temp file" msgstr "Cannot create temp file" @@ -361,7 +357,7 @@ msgstr "Checking previous results for {0} (result = {1}, dep = {2})" msgid "Checksum differs from checksum in package.json" msgstr "Checksum differs from checksum in package.json" -#: cli/board/details.go:168 +#: cli/board/details.go:172 msgid "Checksum:" msgstr "Checksum:" @@ -369,7 +365,7 @@ msgstr "Checksum:" msgid "Clean caches." msgstr "Clean caches." -#: cli/cli.go:113 +#: cli/cli.go:111 msgid "Comma-separated list of additional URLs for the Boards Manager." msgstr "Comma-separated list of additional URLs for the Boards Manager." @@ -382,8 +378,8 @@ msgstr "Command keeps running and prints list of connected boards whenever there msgid "Compiled sketch not found in %s" msgstr "Compiled sketch not found in %s" +#: cli/compile/compile.go:73 #: cli/compile/compile.go:74 -#: cli/compile/compile.go:75 msgid "Compiles Arduino sketches." msgstr "Compiles Arduino sketches." @@ -411,15 +407,11 @@ msgstr "Config file already exists, use --overwrite to discard the existing one. msgid "Config file written to: %s" msgstr "Config file written to: %s" -#: cli/monitor/monitor.go:61 -msgid "Configuration of the port." -msgstr "Configuration of the port." - -#: cli/debug/debug.go:153 +#: cli/debug/debug.go:156 msgid "Configuration options for %s" msgstr "Configuration options for %s" -#: commands/instances.go:857 +#: commands/instances.go:846 msgid "Configuring platform" msgstr "Configuring platform" @@ -431,10 +423,6 @@ msgstr "Configuring platform." msgid "Connected" msgstr "Connected" -#: cli/monitor/monitor.go:174 -msgid "Connected to %s! Press CTRL-C to exit." -msgstr "Connected to %s! Press CTRL-C to exit." - #: cli/board/list.go:87 #: cli/board/list.go:125 msgid "Core" @@ -448,10 +436,14 @@ msgstr "Core name" msgid "Could not connect via HTTP" msgstr "Could not connect via HTTP" -#: commands/instances.go:373 +#: commands/instances.go:362 msgid "Could not create index directory" msgstr "Could not create index directory" +#: cli/sketch/new.go:58 +msgid "Could not create sketch directory: %v" +msgstr "Could not create sketch directory: %v" + #: legacy/builder/phases/core_builder.go:48 msgid "Couldn't deeply cache core build: {0}" msgstr "Couldn't deeply cache core build: {0}" @@ -465,8 +457,8 @@ msgstr "Couldn't determine program size" msgid "Couldn't get current working directory: %v" msgstr "Couldn't get current working directory: %v" -#: cli/sketch/new.go:35 -#: cli/sketch/new.go:36 +#: cli/sketch/new.go:32 +#: cli/sketch/new.go:33 msgid "Create a new Sketch" msgstr "Create a new Sketch" @@ -492,7 +484,7 @@ msgstr "Debug Arduino sketches." msgid "Debug Arduino sketches. (this command opens an interactive gdb session)" msgstr "Debug Arduino sketches. (this command opens an interactive gdb session)" -#: cli/debug/debug.go:64 +#: cli/debug/debug.go:67 msgid "Debug interpreter e.g.: %s" msgstr "Debug interpreter e.g.: %s" @@ -500,14 +492,10 @@ msgstr "Debug interpreter e.g.: %s" msgid "Debugging not supported for board %s" msgstr "Debugging not supported for board %s" -#: cli/board/details.go:124 +#: cli/board/details.go:128 msgid "Debugging supported:" msgstr "Debugging supported:" -#: cli/monitor/monitor.go:192 -msgid "Default" -msgstr "Default" - #: cli/cache/clean.go:31 msgid "Delete Boards/Library Manager download cache." msgstr "Delete Boards/Library Manager download cache." @@ -541,11 +529,11 @@ msgstr "Detecting libraries used..." msgid "Detects and displays a list of boards connected to the current computer." msgstr "Detects and displays a list of boards connected to the current computer." -#: cli/debug/debug.go:65 +#: cli/debug/debug.go:68 msgid "Directory containing binaries for debug." msgstr "Directory containing binaries for debug." -#: cli/upload/upload.go:59 +#: cli/upload/upload.go:62 msgid "Directory containing binaries to upload." msgstr "Directory containing binaries to upload." @@ -569,8 +557,8 @@ msgstr "Display only the provided gRPC calls" msgid "Do not install dependencies." msgstr "Do not install dependencies." -#: cli/burnbootloader/burnbootloader.go:58 -#: cli/upload/upload.go:64 +#: cli/burnbootloader/burnbootloader.go:61 +#: cli/upload/upload.go:67 msgid "Do not perform the actual upload, just log out actions" msgstr "Do not perform the actual upload, just log out actions" @@ -578,8 +566,8 @@ msgstr "Do not perform the actual upload, just log out actions" msgid "Do not terminate daemon process if the parent process dies" msgstr "Do not terminate daemon process if the parent process dies" -#: commands/instances.go:708 -#: commands/instances.go:767 +#: commands/instances.go:697 +#: commands/instances.go:756 #: commands/lib/download.go:57 msgid "Downloading %s" msgstr "Downloading %s" @@ -655,8 +643,8 @@ msgstr "Error creating output dir" msgid "Error creating sketch archive" msgstr "Error creating sketch archive" -#: cli/sketch/new.go:50 -#: cli/sketch/new.go:59 +#: cli/sketch/new.go:54 +#: cli/sketch/new.go:64 msgid "Error creating sketch: %v" msgstr "Error creating sketch: %v" @@ -670,49 +658,49 @@ msgstr "Error detecting boards: %v" msgid "Error downloading %[1]s: %[2]v" msgstr "Error downloading %[1]s: %[2]v" -#: commands/instances.go:478 -#: commands/instances.go:482 -#: commands/instances.go:487 +#: commands/instances.go:467 +#: commands/instances.go:471 +#: commands/instances.go:476 msgid "Error downloading index '%s'" msgstr "Error downloading index '%s'" -#: commands/instances.go:511 -#: commands/instances.go:517 +#: commands/instances.go:500 +#: commands/instances.go:506 msgid "Error downloading index signature '%s'" msgstr "Error downloading index signature '%s'" -#: commands/instances.go:710 -#: commands/instances.go:712 +#: commands/instances.go:699 +#: commands/instances.go:701 msgid "Error downloading library" msgstr "Error downloading library" -#: commands/instances.go:387 -#: commands/instances.go:390 +#: commands/instances.go:376 +#: commands/instances.go:379 msgid "Error downloading library_index.json.gz" msgstr "Error downloading library_index.json.gz" -#: commands/instances.go:397 -#: commands/instances.go:400 +#: commands/instances.go:386 +#: commands/instances.go:389 msgid "Error downloading library_index.json.sig" msgstr "Error downloading library_index.json.sig" #: commands/core/download.go:70 #: commands/core/download.go:74 -#: commands/instances.go:793 -#: commands/instances.go:795 +#: commands/instances.go:782 +#: commands/instances.go:784 msgid "Error downloading platform %s" msgstr "Error downloading platform %s" #: commands/core/download.go:83 #: commands/core/download.go:88 -#: commands/instances.go:786 -#: commands/instances.go:787 +#: commands/instances.go:775 +#: commands/instances.go:776 msgid "Error downloading tool %s" msgstr "Error downloading tool %s" -#: cli/debug/debug.go:81 -#: cli/debug/debug.go:86 -#: cli/debug/debug.go:115 +#: cli/debug/debug.go:84 +#: cli/debug/debug.go:89 +#: cli/debug/debug.go:118 msgid "Error during Debug: %v" msgstr "Error during Debug: %v" @@ -720,20 +708,20 @@ msgstr "Error during Debug: %v" msgid "Error during JSON encoding of the output: %v" msgstr "Error during JSON encoding of the output: %v" -#: cli/burnbootloader/burnbootloader.go:70 -#: cli/burnbootloader/burnbootloader.go:83 -#: cli/compile/compile.go:199 -#: cli/compile/compile.go:205 -#: cli/compile/compile.go:215 -#: cli/compile/compile.go:247 -#: cli/upload/upload.go:95 -#: cli/upload/upload.go:101 -#: cli/upload/upload.go:117 -#: cli/upload/upload.go:144 +#: cli/burnbootloader/burnbootloader.go:73 +#: cli/burnbootloader/burnbootloader.go:86 +#: cli/compile/compile.go:198 +#: cli/compile/compile.go:204 +#: cli/compile/compile.go:214 +#: cli/compile/compile.go:246 +#: cli/upload/upload.go:98 +#: cli/upload/upload.go:104 +#: cli/upload/upload.go:120 +#: cli/upload/upload.go:147 msgid "Error during Upload: %v" msgstr "Error during Upload: %v" -#: cli/compile/compile.go:259 +#: cli/compile/compile.go:258 msgid "Error during build: %v" msgstr "Error during build: %v" @@ -749,7 +737,7 @@ msgstr "Error during uninstall: %v" msgid "Error during upgrade: %v" msgstr "Error during upgrade: %v" -#: commands/instances.go:406 +#: commands/instances.go:395 msgid "Error extracting library_index.json.gz" msgstr "Error extracting library_index.json.gz" @@ -757,7 +745,7 @@ msgstr "Error extracting library_index.json.gz" msgid "Error finding build artifacts" msgstr "Error finding build artifacts" -#: cli/debug/debug.go:102 +#: cli/debug/debug.go:105 msgid "Error getting Debug info: %v" msgstr "Error getting Debug info: %v" @@ -765,7 +753,7 @@ msgstr "Error getting Debug info: %v" msgid "Error getting absolute path of sketch archive" msgstr "Error getting absolute path of sketch archive" -#: cli/board/details.go:71 +#: cli/board/details.go:75 msgid "Error getting board details: %v" msgstr "Error getting board details: %v" @@ -786,14 +774,10 @@ msgstr "Error getting current directory for compilation database: %s" msgid "Error getting information for library %s" msgstr "Error getting information for library %s" -#: cli/lib/examples.go:69 +#: cli/lib/examples.go:73 msgid "Error getting libraries info: %v" msgstr "Error getting libraries info: %v" -#: cli/monitor/monitor.go:87 -msgid "Error getting port settings details: %s" -msgstr "Error getting port settings details: %s" - #: legacy/builder/types/context.go:239 msgid "Error in FQBN: %s" msgstr "Error in FQBN: %s" @@ -817,11 +801,11 @@ msgstr "Error installing Git Library: %v" msgid "Error installing Zip Library: %v" msgstr "Error installing Zip Library: %v" -#: commands/instances.go:814 +#: commands/instances.go:803 msgid "Error installing platform %s" msgstr "Error installing platform %s" -#: commands/instances.go:804 +#: commands/instances.go:793 msgid "Error installing tool %s" msgstr "Error installing tool %s" @@ -837,7 +821,7 @@ msgstr "Error listing boards: %v" msgid "Error listing platforms: %v" msgstr "Error listing platforms: %v" -#: cli/compile/compile.go:150 +#: cli/compile/compile.go:149 msgid "Error opening source code overrides data file: %v" msgstr "Error opening source code overrides data file: %v" @@ -870,7 +854,7 @@ msgstr "Error retrieving core list: %v" msgid "Error retrieving outdated cores and libraries: %v" msgstr "Error retrieving outdated cores and libraries: %v" -#: commands/instances.go:830 +#: commands/instances.go:819 msgid "Error rolling-back changes" msgstr "Error rolling-back changes" @@ -878,11 +862,11 @@ msgstr "Error rolling-back changes" msgid "Error rolling-back changes: %s" msgstr "Error rolling-back changes: %s" -#: commands/instances.go:536 +#: commands/instances.go:525 msgid "Error saving downloaded index %s" msgstr "Error saving downloaded index %s" -#: commands/instances.go:540 +#: commands/instances.go:529 msgid "Error saving downloaded index signature" msgstr "Error saving downloaded index signature" @@ -917,7 +901,7 @@ msgid "Error uninstalling platform %s" msgstr "Error uninstalling platform %s" #: commands/core/uninstall.go:96 -#: commands/instances.go:846 +#: commands/instances.go:835 msgid "Error uninstalling tool %s" msgstr "Error uninstalling tool %s" @@ -947,7 +931,7 @@ msgid "Error upgrading libraries: %v" msgstr "Error upgrading libraries: %v" #: commands/core/install.go:143 -#: commands/instances.go:825 +#: commands/instances.go:814 msgid "Error upgrading platform: %s" msgstr "Error upgrading platform: %s" @@ -955,8 +939,8 @@ msgstr "Error upgrading platform: %s" msgid "Error upgrading: %v" msgstr "Error upgrading: %v" -#: commands/instances.go:411 -#: commands/instances.go:521 +#: commands/instances.go:400 +#: commands/instances.go:510 msgid "Error verifying signature" msgstr "Error verifying signature" @@ -973,11 +957,11 @@ msgstr "Error while determining sketch size: %s" msgid "Error writing compilation database: %s" msgstr "Error writing compilation database: %s" -#: commands/instances.go:420 +#: commands/instances.go:409 msgid "Error writing library_index.json" msgstr "Error writing library_index.json" -#: commands/instances.go:423 +#: commands/instances.go:412 msgid "Error writing library_index.json.sig" msgstr "Error writing library_index.json.sig" @@ -985,7 +969,7 @@ msgstr "Error writing library_index.json.sig" msgid "Error: command description is not supported by %v" msgstr "Error: command description is not supported by %v" -#: cli/compile/compile.go:157 +#: cli/compile/compile.go:156 msgid "Error: invalid source code overrides data file: %v" msgstr "Error: invalid source code overrides data file: %v" @@ -993,7 +977,7 @@ msgstr "Error: invalid source code overrides data file: %v" msgid "Event" msgstr "Event" -#: cli/lib/examples.go:118 +#: cli/lib/examples.go:122 msgid "Examples for library %s" msgstr "Examples for library %s" @@ -1001,7 +985,7 @@ msgstr "Examples for library %s" msgid "Examples:" msgstr "Examples:" -#: cli/debug/debug.go:134 +#: cli/debug/debug.go:137 msgid "Executable to debug" msgstr "Executable to debug" @@ -1011,7 +995,7 @@ msgid "Expected compiled sketch in directory %s, but is a file instead" msgstr "Expected compiled sketch in directory %s, but is a file instead" #: cli/board/attach.go:35 -#: cli/board/details.go:41 +#: cli/board/details.go:42 #: cli/board/list.go:87 #: cli/board/list.go:125 #: cli/board/listall.go:84 @@ -1019,7 +1003,7 @@ msgstr "Expected compiled sketch in directory %s, but is a file instead" msgid "FQBN" msgstr "FQBN" -#: cli/board/details.go:121 +#: cli/board/details.go:125 msgid "FQBN:" msgstr "FQBN:" @@ -1067,7 +1051,7 @@ msgstr "Failed to read: {0}" msgid "Failed uploading" msgstr "Failed uploading" -#: cli/board/details.go:166 +#: cli/board/details.go:170 msgid "File:" msgstr "File:" @@ -1087,20 +1071,19 @@ msgstr "Force run of post-install scripts (if the CLI is not running interactive msgid "Force skip of post-install scripts (if the CLI is running interactively)." msgstr "Force skip of post-install scripts (if the CLI is running interactively)." -#: cli/board/details.go:50 +#: cli/board/details.go:51 #: cli/burnbootloader/burnbootloader.go:53 -#: cli/compile/compile.go:85 +#: cli/compile/compile.go:84 #: cli/debug/debug.go:61 -#: cli/monitor/monitor.go:63 #: cli/upload/upload.go:57 msgid "Fully Qualified Board Name, e.g.: arduino:avr:uno" msgstr "Fully Qualified Board Name, e.g.: arduino:avr:uno" -#: cli/debug/debug.go:148 +#: cli/debug/debug.go:151 msgid "GDB Server path" msgstr "GDB Server path" -#: cli/debug/debug.go:147 +#: cli/debug/debug.go:150 msgid "GDB Server type" msgstr "GDB Server type" @@ -1139,21 +1122,20 @@ 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/outdated/outdated.go:62 msgid "ID" msgstr "ID" -#: cli/board/details.go:93 -#: cli/board/details.go:194 +#: cli/board/details.go:97 +#: cli/board/details.go:198 msgid "Id" msgstr "Id" -#: cli/board/details.go:135 +#: cli/board/details.go:139 msgid "Identification properties:" msgstr "Identification properties:" -#: cli/compile/compile.go:118 +#: cli/compile/compile.go:117 msgid "If set built binaries will be exported to the sketch folder." msgstr "If set built binaries will be exported to the sketch folder." @@ -1174,7 +1156,7 @@ msgstr "Includes %s directory in the archive." msgid "Installed" msgstr "Installed" -#: commands/instances.go:733 +#: commands/instances.go:722 #: commands/lib/install.go:112 msgid "Installed %s" msgstr "Installed %s" @@ -1187,7 +1169,7 @@ msgid "Installed version" msgstr "Installed version" #: commands/bundled_tools.go:48 -#: commands/instances.go:716 +#: commands/instances.go:705 #: commands/lib/install.go:92 msgid "Installing %s" msgstr "Installing %s" @@ -1210,11 +1192,11 @@ msgstr "Installs one or more specified libraries into the system." msgid "Internal error in cache" msgstr "Internal error in cache" -#: commands/errors.go:263 +#: commands/errors.go:218 msgid "Invalid '%[1]s' property: %[2]s" msgstr "Invalid '%[1]s' property: %[2]s" -#: cli/cli.go:254 +#: cli/cli.go:252 msgid "Invalid Call : should show Help, but it is available only in TEXT mode." msgstr "Invalid Call : should show Help, but it is available only in TEXT mode." @@ -1230,7 +1212,7 @@ msgstr "Invalid FQBN" msgid "Invalid URL" msgstr "Invalid URL" -#: commands/instances.go:193 +#: commands/instances.go:192 msgid "Invalid additional URL: %v" msgstr "Invalid additional URL: %v" @@ -1271,16 +1253,16 @@ msgstr "Invalid library" msgid "Invalid network.proxy '%[1]s': %[2]s" msgstr "Invalid network.proxy '%[1]s': %[2]s" -#: cli/cli.go:215 +#: cli/cli.go:213 msgid "Invalid option for --log-level: %s" msgstr "Invalid option for --log-level: %s" -#: cli/cli.go:232 +#: cli/cli.go:230 msgid "Invalid output format: %s" msgstr "Invalid output format: %s" -#: commands/instances.go:454 -#: commands/instances.go:528 +#: commands/instances.go:443 +#: commands/instances.go:517 msgid "Invalid package index in %s" msgstr "Invalid package index in %s" @@ -1292,10 +1274,6 @@ msgstr "Invalid parameter %s: version not allowed" msgid "Invalid pid value: '%s'" msgstr "Invalid pid value: '%s'" -#: commands/monitor/monitor.go:122 -msgid "Invalid recipe in platform.txt" -msgstr "Invalid recipe in platform.txt" - #: legacy/builder/phases/sizer.go:162 msgid "Invalid size regexp: %s" msgstr "Invalid size regexp: %s" @@ -1308,7 +1286,7 @@ msgstr "Invalid version" msgid "Invalid vid value: '%s'" msgstr "Invalid vid value: '%s'" -#: cli/compile/compile.go:113 +#: cli/compile/compile.go:112 msgid "Just produce the compilation database, without actually compiling." msgstr "Just produce the compilation database, without actually compiling." @@ -1322,7 +1300,7 @@ msgid "LIBRARY" msgstr "LIBRARY" #: cli/lib/download.go:34 -#: cli/lib/examples.go:38 +#: cli/lib/examples.go:39 #: cli/lib/search.go:39 #: cli/lib/uninstall.go:35 msgid "LIBRARY_NAME" @@ -1336,7 +1314,7 @@ msgstr "Latest" msgid "Library %s is not installed" msgstr "Library %s is not installed" -#: commands/errors.go:311 +#: commands/errors.go:266 msgid "Library '%s' not found" msgstr "Library '%s' not found" @@ -1344,7 +1322,7 @@ msgstr "Library '%s' not found" msgid "Library can't use both '%[1]s' and '%[2]s' folders. Double check {0}" msgstr "Library can't use both '%[1]s' and '%[2]s' folders. Double check {0}" -#: commands/errors.go:427 +#: commands/errors.go:369 msgid "Library install failed" msgstr "Library install failed" @@ -1386,15 +1364,15 @@ msgstr "List all known boards and their corresponding FQBN." msgid "List connected boards." msgstr "List connected boards." -#: cli/compile/compile.go:96 +#: cli/compile/compile.go:95 msgid "List of custom build properties separated by commas. Or can be used multiple times for multiple properties." msgstr "List of custom build properties separated by commas. Or can be used multiple times for multiple properties." -#: cli/compile/compile.go:110 +#: cli/compile/compile.go:109 msgid "List of custom libraries dir paths separated by commas. Or can be used multiple times for multiple libraries dir paths." msgstr "List of custom libraries dir paths separated by commas. Or can be used multiple times for multiple libraries dir paths." -#: cli/compile/compile.go:108 +#: cli/compile/compile.go:107 msgid "List of paths to libraries root folders. Libraries set this way have top priority in case of conflicts. Can be used multiple times for different libraries." msgstr "List of paths to libraries root folders. Libraries set this way have top priority in case of conflicts. Can be used multiple times for different libraries." @@ -1414,13 +1392,13 @@ msgstr "Lists all connected boards." msgid "Lists cores and libraries that can be upgraded" msgstr "Lists cores and libraries that can be upgraded" -#: commands/instances.go:207 -#: commands/instances.go:218 -#: commands/instances.go:329 +#: commands/instances.go:206 +#: commands/instances.go:217 +#: commands/instances.go:318 msgid "Loading index file: %v" msgstr "Loading index file: %v" -#: commands/instances.go:338 +#: commands/instances.go:327 msgid "Loading libraries: %v" msgstr "Loading libraries: %v" @@ -1444,7 +1422,7 @@ msgstr "Maintainer: %s" msgid "Max time to wait for port discovery, e.g.: 30s, 1m" msgstr "Max time to wait for port discovery, e.g.: 30s, 1m" -#: cli/cli.go:108 +#: cli/cli.go:106 msgid "Messages with this level and above will be logged. Valid levels are: %s" msgstr "Messages with this level and above will be logged. Valid levels are: %s" @@ -1456,15 +1434,11 @@ msgstr "Missing '{0}' from library in {1}" msgid "Missing FQBN (Fully Qualified Board Name)" msgstr "Missing FQBN (Fully Qualified Board Name)" -#: commands/errors.go:169 -msgid "Missing port" -msgstr "Missing port" - #: commands/errors.go:157 msgid "Missing port protocol" msgstr "Missing port protocol" -#: commands/errors.go:195 +#: commands/errors.go:169 msgid "Missing programmer" msgstr "Missing programmer" @@ -1472,23 +1446,15 @@ msgstr "Missing programmer" msgid "Missing size regexp" msgstr "Missing size regexp" -#: commands/errors.go:363 +#: commands/errors.go:318 msgid "Missing sketch path" msgstr "Missing sketch path" -#: commands/errors.go:244 -msgid "Monitor '%s' not found" -msgstr "Monitor '%s' not found" - -#: cli/monitor/monitor.go:140 -msgid "Monitor port settings:" -msgstr "Monitor port settings:" - #: legacy/builder/print_used_and_not_used_libraries.go:50 msgid "Multiple libraries were found for \"{0}\"" msgstr "Multiple libraries were found for \"{0}\"" -#: cli/board/details.go:194 +#: cli/board/details.go:198 #: cli/core/list.go:84 #: cli/core/search.go:114 #: cli/lib/list.go:125 @@ -1515,7 +1481,7 @@ msgstr "No boards found." msgid "No colon in first line of depfile" msgstr "No colon in first line of depfile" -#: cli/lib/examples.go:103 +#: cli/lib/examples.go:107 msgid "No libraries found." msgstr "No libraries found." @@ -1535,10 +1501,6 @@ msgstr "No libraries matching your search.\n" "Did you mean...\n" "" -#: commands/errors.go:183 -msgid "No monitor available for the port protocol %s" -msgstr "No monitor available for the port protocol %s" - #: cli/core/search.go:124 msgid "No platforms matching your search." msgstr "No platforms matching your search." @@ -1555,7 +1517,7 @@ msgstr "No updates available." msgid "No upload port found, using %s as fallback" msgstr "No upload port found, using %s as fallback" -#: commands/errors.go:330 +#: commands/errors.go:285 msgid "No valid dependencies solution found" msgstr "No valid dependencies solution found" @@ -1577,50 +1539,45 @@ msgstr "Not found: {0}" msgid "Not used: {0}" msgstr "Not used: {0}" -#: cli/board/details.go:165 +#: cli/board/details.go:169 msgid "OS:" msgstr "OS:" -#: cli/board/details.go:129 +#: cli/board/details.go:133 msgid "Official Arduino board:" msgstr "Official Arduino board:" -#: cli/monitor/monitor.go:52 -#: cli/monitor/monitor.go:53 -msgid "Open a communication port with a board." -msgstr "Open a communication port with a board." - -#: cli/board/details.go:177 +#: cli/board/details.go:181 msgid "Option:" msgstr "Option:" -#: cli/compile/compile.go:100 +#: cli/compile/compile.go:99 msgid "Optional, can be: %s. Used to tell gcc which warning level to use (-W flag)." msgstr "Optional, can be: %s. Used to tell gcc which warning level to use (-W flag)." -#: cli/compile/compile.go:114 +#: cli/compile/compile.go:113 msgid "Optional, cleanup the build folder and do not use any cached build." msgstr "Optional, cleanup the build folder and do not use any cached build." -#: cli/compile/compile.go:111 +#: cli/compile/compile.go:110 msgid "Optional, optimize compile output for debugging, rather than for release." msgstr "Optional, optimize compile output for debugging, rather than for release." -#: cli/compile/compile.go:102 +#: cli/compile/compile.go:101 msgid "Optional, suppresses almost every output." msgstr "Optional, suppresses almost every output." -#: cli/compile/compile.go:101 -#: cli/upload/upload.go:62 +#: cli/compile/compile.go:100 +#: cli/upload/upload.go:65 msgid "Optional, turns on verbose mode." msgstr "Optional, turns on verbose mode." -#: cli/compile/compile.go:112 -#: cli/upload/upload.go:63 +#: cli/compile/compile.go:111 +#: cli/upload/upload.go:66 msgid "Optional, use the specified programmer to upload." msgstr "Optional, use the specified programmer to upload." -#: cli/compile/compile.go:119 +#: cli/compile/compile.go:118 msgid "Optional. Path to a .json file that contains a set of replacements of the sketch source code." msgstr "Optional. Path to a .json file that contains a set of replacements of the sketch source code." @@ -1628,7 +1585,7 @@ msgstr "Optional. Path to a .json file that contains a set of replacements of th msgid "OutputRate in Null monitor must be a float64" msgstr "OutputRate in Null monitor must be a float64" -#: cli/compile/compile.go:98 +#: cli/compile/compile.go:97 msgid "Override a build property with a custom value. Can be used multiple times for multiple properties." msgstr "Override a build property with a custom value. Can be used multiple times for multiple properties." @@ -1643,23 +1600,23 @@ msgstr "Overwrite existing config file." msgid "PACKAGER" msgstr "PACKAGER" -#: cli/board/details.go:145 +#: cli/board/details.go:149 msgid "Package URL:" msgstr "Package URL:" -#: cli/board/details.go:144 +#: cli/board/details.go:148 msgid "Package maintainer:" msgstr "Package maintainer:" -#: cli/board/details.go:143 +#: cli/board/details.go:147 msgid "Package name:" msgstr "Package name:" -#: cli/board/details.go:147 +#: cli/board/details.go:151 msgid "Package online help:" msgstr "Package online help:" -#: cli/board/details.go:146 +#: cli/board/details.go:150 msgid "Package website:" msgstr "Package website:" @@ -1667,11 +1624,11 @@ msgstr "Package website:" msgid "Paragraph: %s" msgstr "Paragraph: %s" -#: cli/cli.go:109 +#: cli/cli.go:107 msgid "Path to the file where logs will be written." msgstr "Path to the file where logs will be written." -#: cli/compile/compile.go:94 +#: cli/compile/compile.go:93 msgid "Path where to save compiled files. If omitted, a directory will be created in the default temporary path of your OS." msgstr "Path where to save compiled files. If omitted, a directory will be created in the default temporary path of your OS." @@ -1691,11 +1648,11 @@ msgstr "Platform %s installed" msgid "Platform %s uninstalled" msgstr "Platform %s uninstalled" -#: commands/errors.go:348 +#: commands/errors.go:303 msgid "Platform '%s' is already at the latest version" msgstr "Platform '%s' is already at the latest version" -#: commands/errors.go:292 +#: commands/errors.go:247 msgid "Platform '%s' not found" msgstr "Platform '%s' not found" @@ -1703,31 +1660,31 @@ msgstr "Platform '%s' not found" msgid "Platform ID" msgstr "Platform ID" -#: cli/board/details.go:153 +#: cli/board/details.go:157 msgid "Platform URL:" msgstr "Platform URL:" -#: cli/board/details.go:152 +#: cli/board/details.go:156 msgid "Platform architecture:" msgstr "Platform architecture:" -#: cli/board/details.go:151 +#: cli/board/details.go:155 msgid "Platform category:" msgstr "Platform category:" -#: cli/board/details.go:158 +#: cli/board/details.go:162 msgid "Platform checksum:" msgstr "Platform checksum:" -#: cli/board/details.go:154 +#: cli/board/details.go:158 msgid "Platform file name:" msgstr "Platform file name:" -#: cli/board/details.go:150 +#: cli/board/details.go:154 msgid "Platform name:" msgstr "Platform name:" -#: cli/board/details.go:156 +#: cli/board/details.go:160 msgid "Platform size (bytes):" msgstr "Platform size (bytes):" @@ -1736,29 +1693,20 @@ msgstr "Platform size (bytes):" msgid "Port" msgstr "Port" -#: cli/monitor/monitor.go:161 -#: cli/monitor/monitor.go:168 -msgid "Port closed:" -msgstr "Port closed:" - -#: commands/errors.go:521 -msgid "Port monitor error" -msgstr "Port monitor error" - #: legacy/builder/phases/libraries_builder.go:101 #: legacy/builder/phases/libraries_builder.go:109 msgid "Precompiled library in \"{0}\" not found" msgstr "Precompiled library in \"{0}\" not found" -#: cli/board/details.go:42 +#: cli/board/details.go:43 msgid "Print details about a board." msgstr "Print details about a board." -#: cli/compile/compile.go:90 +#: cli/compile/compile.go:89 msgid "Print preprocessed code to stdout instead of compiling." msgstr "Print preprocessed code to stdout instead of compiling." -#: cli/cli.go:107 +#: cli/cli.go:105 msgid "Print the logs on the standard output." msgstr "Print the logs on the standard output." @@ -1770,19 +1718,19 @@ msgstr "Prints the current configuration" msgid "Prints the current configuration." msgstr "Prints the current configuration." -#: commands/errors.go:225 +#: commands/errors.go:199 msgid "Programmer '%s' not found" msgstr "Programmer '%s' not found" -#: cli/board/details.go:93 +#: cli/board/details.go:97 msgid "Programmer name" msgstr "Programmer name" -#: cli/debug/debug.go:63 +#: cli/debug/debug.go:66 msgid "Programmer to use for debugging" msgstr "Programmer to use for debugging" -#: cli/board/details.go:194 +#: cli/board/details.go:198 msgid "Programmers:" msgstr "Programmers:" @@ -1790,7 +1738,7 @@ msgstr "Programmers:" msgid "Progress {0}" msgstr "Progress {0}" -#: commands/errors.go:277 +#: commands/errors.go:232 msgid "Property '%s' is undefined" msgstr "Property '%s' is undefined" @@ -1807,12 +1755,12 @@ msgstr "Provides includes: %s" msgid "Removes one or more values from a setting." msgstr "Removes one or more values from a setting." -#: commands/instances.go:726 +#: commands/instances.go:715 #: commands/lib/install.go:105 msgid "Replacing %[1]s with %[2]s" msgstr "Replacing %[1]s with %[2]s" -#: cli/board/details.go:162 +#: cli/board/details.go:166 msgid "Required tool:" msgstr "Required tool:" @@ -1820,10 +1768,6 @@ msgstr "Required tool:" msgid "Run as a daemon on port: %s" msgstr "Run as a daemon on port: %s" -#: cli/monitor/monitor.go:62 -msgid "Run in silent mode, show only monitor input and output." -msgstr "Run in silent mode, show only monitor input and output." - #: cli/daemon/daemon.go:51 msgid "Running as a daemon the initialization of cores and libraries is done only once." msgstr "Running as a daemon the initialization of cores and libraries is done only once." @@ -1836,7 +1780,7 @@ msgstr "Running normal build of the core..." msgid "Running recipe: {0}" msgstr "Running recipe: {0}" -#: cli/compile/compile.go:92 +#: cli/compile/compile.go:91 msgid "Save build artifacts in this directory." msgstr "Save build artifacts in this directory." @@ -1878,10 +1822,6 @@ 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 -msgid "Setting" -msgstr "Setting" - #: cli/config/delete.go:57 #: cli/config/validate.go:45 msgid "Settings key doesn't exist" @@ -1891,28 +1831,24 @@ msgstr "Settings key doesn't exist" msgid "Show all available core versions." msgstr "Show all available core versions." -#: cli/compile/compile.go:89 +#: cli/compile/compile.go:88 msgid "Show all build properties used instead of compiling." msgstr "Show all build properties used instead of compiling." -#: cli/monitor/monitor.go:60 -msgid "Show all the settings of the communication port." -msgstr "Show all the settings of the communication port." - #: cli/board/listall.go:45 #: cli/board/search.go:46 msgid "Show also boards marked as 'hidden' in the platform" msgstr "Show also boards marked as 'hidden' in the platform" -#: cli/board/details.go:49 +#: cli/board/details.go:50 msgid "Show full board details" msgstr "Show full board details" -#: cli/board/details.go:43 +#: cli/board/details.go:44 msgid "Show information about a board, in particular if the board has options to be specified in the FQBN." msgstr "Show information about a board, in particular if the board has options to be specified in the FQBN." -#: cli/lib/examples.go:45 +#: cli/lib/examples.go:46 #: cli/lib/list.go:49 msgid "Show libraries for the specified board FQBN." msgstr "Show libraries for the specified board FQBN." @@ -1921,11 +1857,11 @@ msgstr "Show libraries for the specified board FQBN." msgid "Show library names only." msgstr "Show library names only." -#: cli/board/details.go:51 +#: cli/board/details.go:55 msgid "Show list of available programmers" msgstr "Show list of available programmers" -#: cli/debug/debug.go:66 +#: cli/debug/debug.go:69 msgid "Show metadata about the debug session instead of starting the debugger." msgstr "Show metadata about the debug session instead of starting the debugger." @@ -1954,11 +1890,11 @@ msgstr "Shows a list of installed libraries.\n" msgid "Shows the list of installed platforms." msgstr "Shows the list of installed platforms." -#: cli/lib/examples.go:39 +#: cli/lib/examples.go:40 msgid "Shows the list of the examples for libraries." msgstr "Shows the list of the examples for libraries." -#: cli/lib/examples.go:40 +#: cli/lib/examples.go:41 msgid "Shows the list of the examples for libraries. A name may be given as argument to search a specific library." msgstr "Shows the list of the examples for libraries. A name may be given as argument to search a specific library." @@ -1970,7 +1906,7 @@ msgstr "Shows the version number of Arduino CLI which is installed on your syste msgid "Shows version number of Arduino CLI." msgstr "Shows version number of Arduino CLI." -#: cli/board/details.go:167 +#: cli/board/details.go:171 msgid "Size (bytes):" msgstr "Size (bytes):" @@ -1978,7 +1914,7 @@ msgstr "Size (bytes):" msgid "Sketch cannot be located in build path. Please specify a different build path" msgstr "Sketch cannot be located in build path. Please specify a different build path" -#: cli/sketch/new.go:63 +#: cli/sketch/new.go:68 msgid "Sketch created in: %s" msgstr "Sketch created in: %s" @@ -1990,9 +1926,9 @@ msgstr "Sketch too big; see %s for tips on reducing it." msgid "Sketch uses {0} bytes ({2}%%) of program storage space. Maximum is {1} bytes." msgstr "Sketch uses {0} bytes ({2}%%) of program storage space. Maximum is {1} bytes." -#: cli/compile/compile.go:140 +#: cli/compile/compile.go:139 #: cli/sketch/archive.go:66 -#: cli/upload/upload.go:87 +#: cli/upload/upload.go:90 msgid "Sketches with .pde extension are deprecated, please rename the following files to .ino:" msgstr "Sketches with .pde extension are deprecated, please rename the following files to .ino:" @@ -2016,7 +1952,7 @@ msgstr "Skipping compile of: {0}" msgid "Skipping dependencies detection for precompiled library {0}" msgstr "Skipping dependencies detection for precompiled library {0}" -#: commands/instances.go:863 +#: commands/instances.go:852 msgid "Skipping platform configuration" msgstr "Skipping platform configuration" @@ -2044,7 +1980,7 @@ msgstr "The connected devices search timeout, raise it if your board doesn't sho msgid "The connected devices search timeout, raise it if your board doesn't show up e.g.: 10s" msgstr "The connected devices search timeout, raise it if your board doesn't show up e.g.: 10s" -#: cli/cli.go:112 +#: cli/cli.go:110 msgid "The custom config file (if not specified the default will be used)." msgstr "The custom config file (if not specified the default will be used)." @@ -2064,8 +2000,8 @@ msgid "The key '%[1]v' is not a list of items, can't remove from it.\n" msgstr "The key '%[1]v' is not a list of items, can't remove from it.\n" "Maybe use '%[2]s'?" -#: cli/cli.go:110 -#: cli/cli.go:111 +#: cli/cli.go:108 +#: cli/cli.go:109 msgid "The output format for the logs, can be: %s" msgstr "The output format for the logs, can be: %s" @@ -2085,7 +2021,7 @@ msgstr "This commands shows a list of installed cores and/or libraries\n" #: commands/bundled_tools.go:43 #: commands/core/install.go:79 -#: commands/instances.go:777 +#: commands/instances.go:766 msgid "Tool %s already installed" msgstr "Tool %s already installed" @@ -2097,23 +2033,23 @@ msgstr "Tool %s uninstalled" msgid "Toolchain '%s' is not supported" msgstr "Toolchain '%s' is not supported" -#: cli/debug/debug.go:142 +#: cli/debug/debug.go:145 msgid "Toolchain custom configurations" msgstr "Toolchain custom configurations" -#: cli/debug/debug.go:136 +#: cli/debug/debug.go:139 msgid "Toolchain path" msgstr "Toolchain path" -#: cli/debug/debug.go:137 +#: cli/debug/debug.go:140 msgid "Toolchain prefix" msgstr "Toolchain prefix" -#: cli/debug/debug.go:135 +#: cli/debug/debug.go:138 msgid "Toolchain type" msgstr "Toolchain type" -#: cli/burnbootloader/burnbootloader.go:56 +#: cli/burnbootloader/burnbootloader.go:59 msgid "Turns on verbose mode." msgstr "Turns on verbose mode." @@ -2126,7 +2062,7 @@ msgstr "Type" msgid "Types: %s" msgstr "Types: %s" -#: cli/board/details.go:169 +#: cli/board/details.go:173 msgid "URL:" msgstr "URL:" @@ -2147,7 +2083,7 @@ msgstr "Unable to get Local App Data Folder: %v" msgid "Unable to get user home dir: %v" msgstr "Unable to get user home dir: %v" -#: cli/cli.go:201 +#: cli/cli.go:199 msgid "Unable to open file for logging: %s" msgstr "Unable to open file for logging: %s" @@ -2160,7 +2096,7 @@ msgstr "Uninstalling %s" msgid "Uninstalling %s, tool is no more required" msgstr "Uninstalling %s, tool is no more required" -#: commands/instances.go:842 +#: commands/instances.go:831 msgid "Uninstalling %s: tool is no more required" msgstr "Uninstalling %s: tool is no more required" @@ -2206,21 +2142,21 @@ msgstr "Updates the libraries index to the latest version." msgid "Updates the libraries index." msgstr "Updates the libraries index." -#: commands/instances.go:459 -#: commands/instances.go:485 -#: commands/instances.go:515 +#: commands/instances.go:448 +#: commands/instances.go:474 +#: commands/instances.go:504 msgid "Updating index: %s" msgstr "Updating index: %s" -#: commands/instances.go:386 +#: commands/instances.go:375 msgid "Updating index: library_index.json.gz" msgstr "Updating index: library_index.json.gz" -#: commands/instances.go:396 +#: commands/instances.go:385 msgid "Updating index: library_index.json.sig" msgstr "Updating index: library_index.json.sig" -#: commands/instances.go:799 +#: commands/instances.go:788 msgid "Updating platform %s" msgstr "Updating platform %s" @@ -2269,7 +2205,7 @@ msgstr "Upload port found on %s" msgid "Upload port protocol, e.g: serial" msgstr "Upload port protocol, e.g: serial" -#: cli/compile/compile.go:103 +#: cli/compile/compile.go:102 msgid "Upload the binary after the compilation." msgstr "Upload the binary after the compilation." @@ -2281,8 +2217,8 @@ msgstr "Upload the bootloader on the board using an external programmer." msgid "Upload the bootloader." msgstr "Upload the bootloader." -#: cli/compile/compile.go:221 -#: cli/upload/upload.go:123 +#: cli/compile/compile.go:220 +#: cli/upload/upload.go:126 msgid "Uploading to specified board using %s protocol requires the following info:" msgstr "Uploading to specified board using %s protocol requires the following info:" @@ -2294,7 +2230,7 @@ msgstr "Usage:" msgid "Use %s for more information about a command." msgstr "Use %s for more information about a command." -#: cli/burnbootloader/burnbootloader.go:57 +#: cli/burnbootloader/burnbootloader.go:60 msgid "Use the specified programmer to upload." msgstr "Use the specified programmer to upload." @@ -2353,13 +2289,9 @@ msgstr "VERSION" msgid "VERSION_NUMBER" msgstr "VERSION_NUMBER" -#: cli/monitor/monitor.go:192 -msgid "Values" -msgstr "Values" - -#: cli/burnbootloader/burnbootloader.go:55 -#: cli/compile/compile.go:105 -#: cli/upload/upload.go:61 +#: cli/burnbootloader/burnbootloader.go:58 +#: cli/compile/compile.go:104 +#: cli/upload/upload.go:64 msgid "Verify uploaded binary after the upload." msgstr "Verify uploaded binary after the upload." @@ -2375,7 +2307,7 @@ msgstr "Versions: %s" msgid "WARNING cannot configure platform: %s" msgstr "WARNING cannot configure platform: %s" -#: commands/instances.go:859 +#: commands/instances.go:848 msgid "WARNING: cannot run post install: %s" msgstr "WARNING: cannot run post install: %s" @@ -2403,7 +2335,7 @@ msgstr "Warning: tool '%s' is not installed. It might not be available for your msgid "Website: %s" msgstr "Website: %s" -#: cli/compile/compile.go:106 +#: cli/compile/compile.go:105 msgid "When specified, VID/PID specific build properties are used, if board supports them." msgstr "When specified, VID/PID specific build properties are used, if board supports them." @@ -2474,7 +2406,7 @@ msgstr "can't find latest release of %s" msgid "can't find main Sketch file in %s" msgstr "can't find main Sketch file in %s" -#: arduino/cores/packagemanager/loader.go:791 +#: arduino/cores/packagemanager/loader.go:768 msgid "can't find pattern for discovery with id %s" msgstr "can't find pattern for discovery with id %s" @@ -2504,11 +2436,11 @@ msgstr "checking local archive integrity" msgid "cleaning build path" msgstr "cleaning build path" -#: cli/cli.go:74 +#: cli/cli.go:73 msgid "command" msgstr "command" -#: arduino/monitor/monitor.go:149 +#: arduino/monitor/monitor.go:157 msgid "command '%[1]s' failed: %[2]s" msgstr "command '%[1]s' failed: %[2]s" @@ -2521,7 +2453,7 @@ msgstr "command '%[1]s' failed: %[2]s" msgid "command failed: %s" msgstr "command failed: %s" -#: arduino/monitor/monitor.go:146 +#: arduino/monitor/monitor.go:154 msgid "communication out of sync, expected '%[1]s', received '%[2]s'" msgstr "communication out of sync, expected '%[1]s', received '%[2]s'" @@ -2557,7 +2489,7 @@ msgstr "computing hash: %s" msgid "could not find a valid build artifact" msgstr "could not find a valid build artifact" -#: arduino/cores/packagemanager/loader.go:728 +#: arduino/cores/packagemanager/loader.go:705 msgid "creating discovery: %s" msgstr "creating discovery: %s" @@ -2598,11 +2530,11 @@ msgstr "directory doesn't exist: %s" msgid "discovery %[1]s process not started: %[2]w" msgstr "discovery %[1]s process not started: %[2]w" -#: arduino/cores/packagemanager/loader.go:719 +#: arduino/cores/packagemanager/loader.go:696 msgid "discovery not found: %s" msgstr "discovery not found: %s" -#: arduino/cores/packagemanager/loader.go:723 +#: arduino/cores/packagemanager/loader.go:700 msgid "discovery not installed: %s" msgstr "discovery not installed: %s" @@ -2648,7 +2580,7 @@ msgstr "error processing response from server" msgid "error querying Arduino Cloud Api" msgstr "error querying Arduino Cloud Api" -#: cli/upload/upload.go:71 +#: cli/upload/upload.go:74 msgid "error: %s and %s flags cannot be used together" msgstr "error: %s and %s flags cannot be used together" @@ -2684,7 +2616,7 @@ msgstr "find abs path: %s" msgid "first message must contain monitor configuration, not data" msgstr "first message must contain monitor configuration, not data" -#: cli/cli.go:74 +#: cli/cli.go:73 msgid "flags" msgstr "flags" @@ -2739,7 +2671,7 @@ msgstr "getting build properties for board %[1]s: %[2]s" msgid "getting discovery dependencies for platform %[1]s: %[2]s" msgstr "getting discovery dependencies for platform %[1]s: %[2]s" -#: arduino/cores/packagemanager/loader.go:672 +#: arduino/cores/packagemanager/loader.go:649 msgid "getting parent dir of %[1]s: %[2]s" msgstr "getting parent dir of %[1]s: %[2]s" @@ -2856,18 +2788,6 @@ msgstr "invalid path writing inventory file: %[1]s error: %[2]w" msgid "invalid platform archive size: %s" msgstr "invalid platform archive size: %s" -#: arduino/cores/packagemanager/loader.go:369 -msgid "invalid pluggable monitor reference: %s" -msgstr "invalid pluggable monitor reference: %s" - -#: cli/monitor/monitor.go:123 -msgid "invalid port configuration value for %s: %s" -msgstr "invalid port configuration value for %s: %s" - -#: cli/monitor/monitor.go:132 -msgid "invalid port configuration: %s" -msgstr "invalid port configuration: %s" - #: commands/upload/upload.go:483 msgid "invalid recipe '%[1]s': %[2]s" msgstr "invalid recipe '%[1]s': %[2]s" @@ -2919,11 +2839,11 @@ msgstr "listing serial ports" msgid "loading %[1]s: %[2]s" msgstr "loading %[1]s: %[2]s" -#: arduino/cores/packagemanager/loader.go:357 +#: arduino/cores/packagemanager/loader.go:356 msgid "loading boards: %s" msgstr "loading boards: %s" -#: arduino/cores/packagemanager/loader.go:627 +#: arduino/cores/packagemanager/loader.go:604 msgid "loading bundled tools from %[1]s: %[2]s" msgstr "loading bundled tools from %[1]s: %[2]s" @@ -2950,7 +2870,7 @@ msgstr "loading platform release %[1]s: %[2]s" msgid "loading platform.txt: %v" msgstr "loading platform.txt: %v" -#: arduino/cores/packagemanager/loader.go:594 +#: arduino/cores/packagemanager/loader.go:571 msgid "loading tool release in %[1]s: %[2]s" msgstr "loading tool release in %[1]s: %[2]s" @@ -3003,7 +2923,7 @@ msgstr "no compatible version of %s tools found for the current os" msgid "no executable specified" msgstr "no executable specified" -#: commands/daemon/daemon.go:100 +#: commands/daemon/daemon.go:96 msgid "no instance specified" msgstr "no instance specified" @@ -3094,12 +3014,12 @@ msgstr "platform %s is not installed" #: arduino/cores/packagemanager/install_uninstall.go:65 #: arduino/cores/packagemanager/install_uninstall.go:108 -#: arduino/cores/packagemanager/loader.go:456 +#: arduino/cores/packagemanager/loader.go:433 #: commands/compile/compile.go:127 msgid "platform not installed" msgstr "platform not installed" -#: cli/compile/compile.go:124 +#: cli/compile/compile.go:123 msgid "please use --build-property instead." msgstr "please use --build-property instead." @@ -3111,11 +3031,11 @@ msgstr "pluggable discovery already added: %s" msgid "port" msgstr "port" -#: cli/arguments/port.go:137 +#: cli/arguments/port.go:122 msgid "port not found: %[1]s %[2]s" msgstr "port not found: %[1]s %[2]s" -#: arduino/monitor/monitor.go:238 +#: arduino/monitor/monitor.go:246 msgid "protocol version not supported: requested %[1]d, got %[2]d" msgstr "protocol version not supported: requested %[1]d, got %[2]d" @@ -3131,7 +3051,7 @@ msgstr "quitting discovery %[1]s: %[2]w" msgid "reading %[1]s directory: %[2]s" msgstr "reading %[1]s directory: %[2]s" -#: arduino/cores/packagemanager/loader.go:677 +#: arduino/cores/packagemanager/loader.go:654 msgid "reading %[1]s: %[2]s" msgstr "reading %[1]s: %[2]s" @@ -3141,7 +3061,7 @@ msgid "reading dir %[1]s: %[2]s" msgstr "reading dir %[1]s: %[2]s" #: arduino/cores/packagemanager/loader.go:162 -#: arduino/cores/packagemanager/loader.go:585 +#: arduino/cores/packagemanager/loader.go:562 msgid "reading directory %[1]s: %[2]s" msgstr "reading directory %[1]s: %[2]s" @@ -3232,7 +3152,7 @@ msgstr "retrieving Arduino public keys: %s" msgid "scanning examples: %s" msgstr "scanning examples: %s" -#: arduino/cores/packagemanager/loader.go:663 +#: arduino/cores/packagemanager/loader.go:640 msgid "searching for builtin_tools_versions.txt in %[1]s: %[2]s" msgstr "searching for builtin_tools_versions.txt in %[1]s: %[2]s" @@ -3253,7 +3173,7 @@ msgstr "sketch path is not valid" msgid "sketchPath" msgstr "sketchPath" -#: arduino/cores/packagemanager/loader.go:519 +#: arduino/cores/packagemanager/loader.go:496 msgid "skipping loading of boards %s: malformed custom board options" msgstr "skipping loading of boards %s: malformed custom board options" @@ -3305,7 +3225,7 @@ msgstr "the platform has no releases" msgid "the server responded with status %s" msgstr "the server responded with status %s" -#: arduino/monitor/monitor.go:139 +#: arduino/monitor/monitor.go:147 msgid "timeout waiting for message" msgstr "timeout waiting for message" From b7263bfed9f7d8aa25084748fdb0a6700927bb03 Mon Sep 17 00:00:00 2001 From: Umberto Baldi Date: Mon, 18 Oct 2021 14:15:31 +0200 Subject: [PATCH 02/22] add completion for `-l` or `--protocol` But does only work for connected boards and do not list every protocol installed --- cli/arguments/completion.go | 15 +++++++++++++++ cli/arguments/port.go | 3 +++ i18n/data/en.po | 4 ++-- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/cli/arguments/completion.go b/cli/arguments/completion.go index 327bb7d7941..c1f047c509c 100644 --- a/cli/arguments/completion.go +++ b/cli/arguments/completion.go @@ -26,3 +26,18 @@ func GetInstalledBoards(toComplete string) []string { } return res } + +// GetInstalledProtocols is an helper function usefull to autocomplete. +// It returns a list of protocols available +func GetInstalledProtocols(toComplete string) []string { + inst := instance.CreateAndInit() // TODO optimize this: it does not make sense to create an instance everytime + + detectedBoards, _ := board.List(&rpc.BoardListRequest{ + Instance: inst, + }) + var res []string + for _, i := range detectedBoards { + res = append(res, i.Port.Protocol) + } + return res +} diff --git a/cli/arguments/port.go b/cli/arguments/port.go index b4643b1039a..46c62b6d7fb 100644 --- a/cli/arguments/port.go +++ b/cli/arguments/port.go @@ -43,6 +43,9 @@ type Port struct { func (p *Port) AddToCommand(cmd *cobra.Command) { cmd.Flags().StringVarP(&p.address, "port", "p", "", tr("Upload port address, e.g.: COM3 or /dev/ttyACM2")) cmd.Flags().StringVarP(&p.protocol, "protocol", "l", "", tr("Upload port protocol, e.g: serial")) + cmd.RegisterFlagCompletionFunc("protocol", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + return GetInstalledProtocols(toComplete), cobra.ShellCompDirectiveDefault + }) cmd.Flags().DurationVar(&p.timeout, "discovery-timeout", 5*time.Second, tr("Max time to wait for port discovery, e.g.: 30s, 1m")) } diff --git a/i18n/data/en.po b/i18n/data/en.po index fa879aa3a12..3ae8e22bd04 100644 --- a/i18n/data/en.po +++ b/i18n/data/en.po @@ -1418,7 +1418,7 @@ msgstr "Low memory available, stability problems may occur." msgid "Maintainer: %s" msgstr "Maintainer: %s" -#: cli/arguments/port.go:46 +#: cli/arguments/port.go:49 msgid "Max time to wait for port discovery, e.g.: 30s, 1m" msgstr "Max time to wait for port discovery, e.g.: 30s, 1m" @@ -3031,7 +3031,7 @@ msgstr "pluggable discovery already added: %s" msgid "port" msgstr "port" -#: cli/arguments/port.go:122 +#: cli/arguments/port.go:125 msgid "port not found: %[1]s %[2]s" msgstr "port not found: %[1]s %[2]s" From b6ed62fa0d3a5bdd55f7edcc44ebdaf9f8397f8f Mon Sep 17 00:00:00 2001 From: Umberto Baldi Date: Tue, 5 Oct 2021 18:21:26 +0200 Subject: [PATCH 03/22] the previous implementation was working only with a board connected to the pc RPC was not exposing that functionality --- cli/arguments/completion.go | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/cli/arguments/completion.go b/cli/arguments/completion.go index c1f047c509c..5804140e128 100644 --- a/cli/arguments/completion.go +++ b/cli/arguments/completion.go @@ -4,6 +4,7 @@ import ( "context" "github.com/arduino/arduino-cli/cli/instance" + "github.com/arduino/arduino-cli/commands" "github.com/arduino/arduino-cli/commands/board" rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1" ) @@ -28,16 +29,28 @@ func GetInstalledBoards(toComplete string) []string { } // GetInstalledProtocols is an helper function usefull to autocomplete. -// It returns a list of protocols available +// It returns a list of protocols available based on the installed boards func GetInstalledProtocols(toComplete string) []string { inst := instance.CreateAndInit() // TODO optimize this: it does not make sense to create an instance everytime + pm := commands.GetPackageManager(inst.Id) + boards := pm.InstalledBoards() - detectedBoards, _ := board.List(&rpc.BoardListRequest{ - Instance: inst, - }) - var res []string - for _, i := range detectedBoards { - res = append(res, i.Port.Protocol) + // use this strange map because it should be more optimized + // we use only the key and not the value because we do not need it + intalledProtocolsMap := make(map[string]struct{}) + for _, board := range boards { + // we filter and elaborate a bit the informations present in Properties + for _, protocol := range board.Properties.SubTree("upload.tool").FirstLevelKeys() { + if protocol != "default" { // remove this value since it's the default one + intalledProtocolsMap[protocol] = struct{}{} + } + } + } + res := make([]string, len(intalledProtocolsMap)) + i := 0 + for k := range intalledProtocolsMap { + res[i] = k + i++ } return res } From 3e57b18c51b3e8eb8e1bfcb67199234969b6eca9 Mon Sep 17 00:00:00 2001 From: Umberto Baldi Date: Wed, 6 Oct 2021 12:44:10 +0200 Subject: [PATCH 04/22] add static completion for `--log-level, `--log-format` and `--format` --- cli/cli.go | 9 +++++ i18n/data/en.po | 98 ++++++++++++++++++++++++------------------------- 2 files changed, 58 insertions(+), 49 deletions(-) diff --git a/cli/cli.go b/cli/cli.go index 14f072f8f6e..8723711bfe9 100644 --- a/cli/cli.go +++ b/cli/cli.go @@ -106,9 +106,18 @@ func createCliCommandTree(cmd *cobra.Command) { cmd.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false, tr("Print the logs on the standard output.")) cmd.PersistentFlags().String("log-level", "", tr("Messages with this level and above will be logged. Valid levels are: %s", "trace, debug, info, warn, error, fatal, panic")) + cmd.RegisterFlagCompletionFunc("log-level", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + return []string{"trace", "debug", "info", "warn", "error", "fatal", "panic"}, cobra.ShellCompDirectiveDefault + }) cmd.PersistentFlags().String("log-file", "", tr("Path to the file where logs will be written.")) cmd.PersistentFlags().String("log-format", "", tr("The output format for the logs, can be: %s", "text, json")) + cmd.RegisterFlagCompletionFunc("log-format", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + return []string{"text", "json"}, cobra.ShellCompDirectiveDefault + }) cmd.PersistentFlags().StringVar(&outputFormat, "format", "text", tr("The output format for the logs, can be: %s", "text, json")) + cmd.RegisterFlagCompletionFunc("format", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + return []string{"text", "json"}, cobra.ShellCompDirectiveDefault + }) cmd.PersistentFlags().StringVar(&configFile, "config-file", "", tr("The custom config file (if not specified the default will be used).")) cmd.PersistentFlags().StringSlice("additional-urls", []string{}, tr("Comma-separated list of additional URLs for the Boards Manager.")) cmd.PersistentFlags().Bool("no-color", false, "Disable colored output.") diff --git a/i18n/data/en.po b/i18n/data/en.po index 3ae8e22bd04..e711a4b11aa 100644 --- a/i18n/data/en.po +++ b/i18n/data/en.po @@ -365,7 +365,7 @@ msgstr "Checksum:" msgid "Clean caches." msgstr "Clean caches." -#: cli/cli.go:111 +#: cli/cli.go:120 msgid "Comma-separated list of additional URLs for the Boards Manager." msgstr "Comma-separated list of additional URLs for the Boards Manager." @@ -407,7 +407,7 @@ msgstr "Config file already exists, use --overwrite to discard the existing one. msgid "Config file written to: %s" msgstr "Config file written to: %s" -#: cli/debug/debug.go:156 +#: cli/debug/debug.go:159 msgid "Configuration options for %s" msgstr "Configuration options for %s" @@ -484,7 +484,7 @@ msgstr "Debug Arduino sketches." msgid "Debug Arduino sketches. (this command opens an interactive gdb session)" msgstr "Debug Arduino sketches. (this command opens an interactive gdb session)" -#: cli/debug/debug.go:67 +#: cli/debug/debug.go:70 msgid "Debug interpreter e.g.: %s" msgstr "Debug interpreter e.g.: %s" @@ -529,7 +529,7 @@ msgstr "Detecting libraries used..." msgid "Detects and displays a list of boards connected to the current computer." msgstr "Detects and displays a list of boards connected to the current computer." -#: cli/debug/debug.go:68 +#: cli/debug/debug.go:71 msgid "Directory containing binaries for debug." msgstr "Directory containing binaries for debug." @@ -557,8 +557,8 @@ msgstr "Display only the provided gRPC calls" msgid "Do not install dependencies." msgstr "Do not install dependencies." -#: cli/burnbootloader/burnbootloader.go:61 -#: cli/upload/upload.go:67 +#: cli/burnbootloader/burnbootloader.go:64 +#: cli/upload/upload.go:70 msgid "Do not perform the actual upload, just log out actions" msgstr "Do not perform the actual upload, just log out actions" @@ -698,9 +698,9 @@ msgstr "Error downloading platform %s" msgid "Error downloading tool %s" msgstr "Error downloading tool %s" -#: cli/debug/debug.go:84 -#: cli/debug/debug.go:89 -#: cli/debug/debug.go:118 +#: cli/debug/debug.go:87 +#: cli/debug/debug.go:92 +#: cli/debug/debug.go:121 msgid "Error during Debug: %v" msgstr "Error during Debug: %v" @@ -708,20 +708,20 @@ msgstr "Error during Debug: %v" msgid "Error during JSON encoding of the output: %v" msgstr "Error during JSON encoding of the output: %v" -#: cli/burnbootloader/burnbootloader.go:73 -#: cli/burnbootloader/burnbootloader.go:86 -#: cli/compile/compile.go:198 -#: cli/compile/compile.go:204 -#: cli/compile/compile.go:214 -#: cli/compile/compile.go:246 -#: cli/upload/upload.go:98 -#: cli/upload/upload.go:104 -#: cli/upload/upload.go:120 -#: cli/upload/upload.go:147 +#: cli/burnbootloader/burnbootloader.go:76 +#: cli/burnbootloader/burnbootloader.go:89 +#: cli/compile/compile.go:201 +#: cli/compile/compile.go:207 +#: cli/compile/compile.go:217 +#: cli/compile/compile.go:249 +#: cli/upload/upload.go:101 +#: cli/upload/upload.go:107 +#: cli/upload/upload.go:123 +#: cli/upload/upload.go:150 msgid "Error during Upload: %v" msgstr "Error during Upload: %v" -#: cli/compile/compile.go:258 +#: cli/compile/compile.go:261 msgid "Error during build: %v" msgstr "Error during build: %v" @@ -745,7 +745,7 @@ msgstr "Error extracting library_index.json.gz" msgid "Error finding build artifacts" msgstr "Error finding build artifacts" -#: cli/debug/debug.go:105 +#: cli/debug/debug.go:108 msgid "Error getting Debug info: %v" msgstr "Error getting Debug info: %v" @@ -821,7 +821,7 @@ msgstr "Error listing boards: %v" msgid "Error listing platforms: %v" msgstr "Error listing platforms: %v" -#: cli/compile/compile.go:149 +#: cli/compile/compile.go:152 msgid "Error opening source code overrides data file: %v" msgstr "Error opening source code overrides data file: %v" @@ -969,7 +969,7 @@ msgstr "Error writing library_index.json.sig" msgid "Error: command description is not supported by %v" msgstr "Error: command description is not supported by %v" -#: cli/compile/compile.go:156 +#: cli/compile/compile.go:159 msgid "Error: invalid source code overrides data file: %v" msgstr "Error: invalid source code overrides data file: %v" @@ -985,7 +985,7 @@ msgstr "Examples for library %s" msgid "Examples:" msgstr "Examples:" -#: cli/debug/debug.go:137 +#: cli/debug/debug.go:140 msgid "Executable to debug" msgstr "Executable to debug" @@ -1079,11 +1079,11 @@ msgstr "Force skip of post-install scripts (if the CLI is running interactively) msgid "Fully Qualified Board Name, e.g.: arduino:avr:uno" msgstr "Fully Qualified Board Name, e.g.: arduino:avr:uno" -#: cli/debug/debug.go:151 +#: cli/debug/debug.go:154 msgid "GDB Server path" msgstr "GDB Server path" -#: cli/debug/debug.go:150 +#: cli/debug/debug.go:153 msgid "GDB Server type" msgstr "GDB Server type" @@ -1135,7 +1135,7 @@ msgstr "Id" msgid "Identification properties:" msgstr "Identification properties:" -#: cli/compile/compile.go:117 +#: cli/compile/compile.go:120 msgid "If set built binaries will be exported to the sketch folder." msgstr "If set built binaries will be exported to the sketch folder." @@ -1196,7 +1196,7 @@ msgstr "Internal error in cache" msgid "Invalid '%[1]s' property: %[2]s" msgstr "Invalid '%[1]s' property: %[2]s" -#: cli/cli.go:252 +#: cli/cli.go:261 msgid "Invalid Call : should show Help, but it is available only in TEXT mode." msgstr "Invalid Call : should show Help, but it is available only in TEXT mode." @@ -1253,11 +1253,11 @@ msgstr "Invalid library" msgid "Invalid network.proxy '%[1]s': %[2]s" msgstr "Invalid network.proxy '%[1]s': %[2]s" -#: cli/cli.go:213 +#: cli/cli.go:222 msgid "Invalid option for --log-level: %s" msgstr "Invalid option for --log-level: %s" -#: cli/cli.go:230 +#: cli/cli.go:239 msgid "Invalid output format: %s" msgstr "Invalid output format: %s" @@ -1286,7 +1286,7 @@ msgstr "Invalid version" msgid "Invalid vid value: '%s'" msgstr "Invalid vid value: '%s'" -#: cli/compile/compile.go:112 +#: cli/compile/compile.go:115 msgid "Just produce the compilation database, without actually compiling." msgstr "Just produce the compilation database, without actually compiling." @@ -1555,7 +1555,7 @@ msgstr "Option:" msgid "Optional, can be: %s. Used to tell gcc which warning level to use (-W flag)." msgstr "Optional, can be: %s. Used to tell gcc which warning level to use (-W flag)." -#: cli/compile/compile.go:113 +#: cli/compile/compile.go:116 msgid "Optional, cleanup the build folder and do not use any cached build." msgstr "Optional, cleanup the build folder and do not use any cached build." @@ -1577,7 +1577,7 @@ msgstr "Optional, turns on verbose mode." msgid "Optional, use the specified programmer to upload." msgstr "Optional, use the specified programmer to upload." -#: cli/compile/compile.go:118 +#: cli/compile/compile.go:121 msgid "Optional. Path to a .json file that contains a set of replacements of the sketch source code." msgstr "Optional. Path to a .json file that contains a set of replacements of the sketch source code." @@ -1624,7 +1624,7 @@ msgstr "Package website:" msgid "Paragraph: %s" msgstr "Paragraph: %s" -#: cli/cli.go:107 +#: cli/cli.go:110 msgid "Path to the file where logs will be written." msgstr "Path to the file where logs will be written." @@ -1861,7 +1861,7 @@ msgstr "Show library names only." msgid "Show list of available programmers" msgstr "Show list of available programmers" -#: cli/debug/debug.go:69 +#: cli/debug/debug.go:72 msgid "Show metadata about the debug session instead of starting the debugger." msgstr "Show metadata about the debug session instead of starting the debugger." @@ -1926,9 +1926,9 @@ msgstr "Sketch too big; see %s for tips on reducing it." msgid "Sketch uses {0} bytes ({2}%%) of program storage space. Maximum is {1} bytes." msgstr "Sketch uses {0} bytes ({2}%%) of program storage space. Maximum is {1} bytes." -#: cli/compile/compile.go:139 +#: cli/compile/compile.go:142 #: cli/sketch/archive.go:66 -#: cli/upload/upload.go:90 +#: cli/upload/upload.go:93 msgid "Sketches with .pde extension are deprecated, please rename the following files to .ino:" msgstr "Sketches with .pde extension are deprecated, please rename the following files to .ino:" @@ -1980,7 +1980,7 @@ msgstr "The connected devices search timeout, raise it if your board doesn't sho msgid "The connected devices search timeout, raise it if your board doesn't show up e.g.: 10s" msgstr "The connected devices search timeout, raise it if your board doesn't show up e.g.: 10s" -#: cli/cli.go:110 +#: cli/cli.go:119 msgid "The custom config file (if not specified the default will be used)." msgstr "The custom config file (if not specified the default will be used)." @@ -2000,8 +2000,8 @@ msgid "The key '%[1]v' is not a list of items, can't remove from it.\n" msgstr "The key '%[1]v' is not a list of items, can't remove from it.\n" "Maybe use '%[2]s'?" -#: cli/cli.go:108 -#: cli/cli.go:109 +#: cli/cli.go:111 +#: cli/cli.go:115 msgid "The output format for the logs, can be: %s" msgstr "The output format for the logs, can be: %s" @@ -2033,19 +2033,19 @@ msgstr "Tool %s uninstalled" msgid "Toolchain '%s' is not supported" msgstr "Toolchain '%s' is not supported" -#: cli/debug/debug.go:145 +#: cli/debug/debug.go:148 msgid "Toolchain custom configurations" msgstr "Toolchain custom configurations" -#: cli/debug/debug.go:139 +#: cli/debug/debug.go:142 msgid "Toolchain path" msgstr "Toolchain path" -#: cli/debug/debug.go:140 +#: cli/debug/debug.go:143 msgid "Toolchain prefix" msgstr "Toolchain prefix" -#: cli/debug/debug.go:138 +#: cli/debug/debug.go:141 msgid "Toolchain type" msgstr "Toolchain type" @@ -2083,7 +2083,7 @@ msgstr "Unable to get Local App Data Folder: %v" msgid "Unable to get user home dir: %v" msgstr "Unable to get user home dir: %v" -#: cli/cli.go:199 +#: cli/cli.go:208 msgid "Unable to open file for logging: %s" msgstr "Unable to open file for logging: %s" @@ -2217,8 +2217,8 @@ msgstr "Upload the bootloader on the board using an external programmer." msgid "Upload the bootloader." msgstr "Upload the bootloader." -#: cli/compile/compile.go:220 -#: cli/upload/upload.go:126 +#: cli/compile/compile.go:223 +#: cli/upload/upload.go:129 msgid "Uploading to specified board using %s protocol requires the following info:" msgstr "Uploading to specified board using %s protocol requires the following info:" @@ -2580,7 +2580,7 @@ msgstr "error processing response from server" msgid "error querying Arduino Cloud Api" msgstr "error querying Arduino Cloud Api" -#: cli/upload/upload.go:74 +#: cli/upload/upload.go:77 msgid "error: %s and %s flags cannot be used together" msgstr "error: %s and %s flags cannot be used together" @@ -3019,7 +3019,7 @@ msgstr "platform %s is not installed" msgid "platform not installed" msgstr "platform not installed" -#: cli/compile/compile.go:123 +#: cli/compile/compile.go:126 msgid "please use --build-property instead." msgstr "please use --build-property instead." From 0c0823f5f24e49d482c3440213e68f69ca877269 Mon Sep 17 00:00:00 2001 From: Umberto Baldi Date: Wed, 6 Oct 2021 15:54:28 +0200 Subject: [PATCH 05/22] add completion for `-P` or `--programmer` & fix typo --- cli/arguments/completion.go | 38 ++++++++++++++++++++++++++-- cli/burnbootloader/burnbootloader.go | 3 +++ cli/compile/compile.go | 3 +++ cli/debug/debug.go | 3 +++ cli/upload/upload.go | 3 +++ 5 files changed, 48 insertions(+), 2 deletions(-) diff --git a/cli/arguments/completion.go b/cli/arguments/completion.go index 5804140e128..bfd7819c0e4 100644 --- a/cli/arguments/completion.go +++ b/cli/arguments/completion.go @@ -3,13 +3,14 @@ package arguments import ( "context" + "github.com/arduino/arduino-cli/arduino/cores" "github.com/arduino/arduino-cli/cli/instance" "github.com/arduino/arduino-cli/commands" "github.com/arduino/arduino-cli/commands/board" rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1" ) -// GetInstalledBoards is an helper function usefull to autocomplete. +// GetInstalledBoards is an helper function useful to autocomplete. // It returns a list of fqbn // it's taken from cli/board/listall.go func GetInstalledBoards(toComplete string) []string { @@ -28,7 +29,7 @@ func GetInstalledBoards(toComplete string) []string { return res } -// GetInstalledProtocols is an helper function usefull to autocomplete. +// GetInstalledProtocols is an helper function useful to autocomplete. // It returns a list of protocols available based on the installed boards func GetInstalledProtocols(toComplete string) []string { inst := instance.CreateAndInit() // TODO optimize this: it does not make sense to create an instance everytime @@ -54,3 +55,36 @@ func GetInstalledProtocols(toComplete string) []string { } return res } + +// GetInstalledProgrammers is an helper function useful to autocomplete. +// It returns a list of programmers available based on the installed boards +func GetInstalledProgrammers(toComplete string) []string { + inst := instance.CreateAndInit() // TODO optimize this: it does not make sense to create an instance everytime + pm := commands.GetPackageManager(inst.Id) + + // we need the list of the available fqbn in order to get the list of the programmers + list, _ := board.ListAll(context.Background(), &rpc.BoardListAllRequest{ + Instance: inst, + SearchArgs: nil, + IncludeHiddenBoards: false, + }) + + // use this strange map because it should be more optimized + // we use only the key and not the value because we do not need it + installedProgrammers := make(map[string]struct{}) + for _, i := range list.GetBoards() { + fqbn, _ := cores.ParseFQBN(i.Fqbn) + _, boardPlatform, _, _, _, _ := pm.ResolveFQBN(fqbn) + for programmerID := range boardPlatform.Programmers { + installedProgrammers[programmerID] = struct{}{} + } + } + + res := make([]string, len(installedProgrammers)) + i := 0 + for k := range installedProgrammers { + res[i] = k + i++ + } + return res +} diff --git a/cli/burnbootloader/burnbootloader.go b/cli/burnbootloader/burnbootloader.go index 3c3e2d820b7..20d1b57404e 100644 --- a/cli/burnbootloader/burnbootloader.go +++ b/cli/burnbootloader/burnbootloader.go @@ -58,6 +58,9 @@ func NewCommand() *cobra.Command { burnBootloaderCommand.Flags().BoolVarP(&verify, "verify", "t", false, tr("Verify uploaded binary after the upload.")) burnBootloaderCommand.Flags().BoolVarP(&verbose, "verbose", "v", false, tr("Turns on verbose mode.")) burnBootloaderCommand.Flags().StringVarP(&programmer, "programmer", "P", "", tr("Use the specified programmer to upload.")) + burnBootloaderCommand.RegisterFlagCompletionFunc("programmer", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + return arguments.GetInstalledProgrammers(toComplete), cobra.ShellCompDirectiveDefault + }) burnBootloaderCommand.Flags().BoolVar(&dryRun, "dry-run", false, tr("Do not perform the actual upload, just log out actions")) burnBootloaderCommand.Flags().MarkHidden("dry-run") diff --git a/cli/compile/compile.go b/cli/compile/compile.go index 9b4e0f9504e..74301da222d 100644 --- a/cli/compile/compile.go +++ b/cli/compile/compile.go @@ -109,6 +109,9 @@ func NewCommand() *cobra.Command { tr("List of custom libraries dir paths separated by commas. Or can be used multiple times for multiple libraries dir paths.")) command.Flags().BoolVar(&optimizeForDebug, "optimize-for-debug", false, tr("Optional, optimize compile output for debugging, rather than for release.")) command.Flags().StringVarP(&programmer, "programmer", "P", "", tr("Optional, use the specified programmer to upload.")) + command.RegisterFlagCompletionFunc("programmer", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + return arguments.GetInstalledProgrammers(toComplete), cobra.ShellCompDirectiveDefault + }) command.Flags().BoolVar(&compilationDatabaseOnly, "only-compilation-database", false, tr("Just produce the compilation database, without actually compiling.")) command.Flags().BoolVar(&clean, "clean", false, tr("Optional, cleanup the build folder and do not use any cached build.")) // We must use the following syntax for this flag since it's also bound to settings. diff --git a/cli/debug/debug.go b/cli/debug/debug.go index 6ba4f45840c..2242c43567c 100644 --- a/cli/debug/debug.go +++ b/cli/debug/debug.go @@ -64,6 +64,9 @@ func NewCommand() *cobra.Command { }) port.AddToCommand(debugCommand) debugCommand.Flags().StringVarP(&programmer, "programmer", "P", "", tr("Programmer to use for debugging")) + debugCommand.RegisterFlagCompletionFunc("programmer", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + return arguments.GetInstalledProgrammers(toComplete), cobra.ShellCompDirectiveDefault + }) debugCommand.Flags().StringVar(&interpreter, "interpreter", "console", tr("Debug interpreter e.g.: %s", "console, mi, mi1, mi2, mi3")) debugCommand.Flags().StringVarP(&importDir, "input-dir", "", "", tr("Directory containing binaries for debug.")) debugCommand.Flags().BoolVarP(&printInfo, "info", "I", false, tr("Show metadata about the debug session instead of starting the debugger.")) diff --git a/cli/upload/upload.go b/cli/upload/upload.go index c65545d0d93..77dc11a99cd 100644 --- a/cli/upload/upload.go +++ b/cli/upload/upload.go @@ -64,6 +64,9 @@ func NewCommand() *cobra.Command { uploadCommand.Flags().BoolVarP(&verify, "verify", "t", false, tr("Verify uploaded binary after the upload.")) uploadCommand.Flags().BoolVarP(&verbose, "verbose", "v", false, tr("Optional, turns on verbose mode.")) uploadCommand.Flags().StringVarP(&programmer, "programmer", "P", "", tr("Optional, use the specified programmer to upload.")) + uploadCommand.RegisterFlagCompletionFunc("programmer", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + return arguments.GetInstalledProgrammers(toComplete), cobra.ShellCompDirectiveDefault + }) uploadCommand.Flags().BoolVar(&dryRun, "dry-run", false, tr("Do not perform the actual upload, just log out actions")) uploadCommand.Flags().MarkHidden("dry-run") return uploadCommand From fe4ab51be44f5292e4588197ebce4b3cb5971be5 Mon Sep 17 00:00:00 2001 From: Umberto Baldi Date: Wed, 6 Oct 2021 16:44:34 +0200 Subject: [PATCH 06/22] add completion for `core uninstall` maybe could be done better (filter and remove the manually installed ones) --- cli/arguments/completion.go | 19 +++++++++++++++++++ cli/core/uninstall.go | 3 +++ i18n/data/en.po | 6 +++--- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/cli/arguments/completion.go b/cli/arguments/completion.go index bfd7819c0e4..89d123e0353 100644 --- a/cli/arguments/completion.go +++ b/cli/arguments/completion.go @@ -7,6 +7,7 @@ import ( "github.com/arduino/arduino-cli/cli/instance" "github.com/arduino/arduino-cli/commands" "github.com/arduino/arduino-cli/commands/board" + "github.com/arduino/arduino-cli/commands/core" rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1" ) @@ -88,3 +89,21 @@ func GetInstalledProgrammers(toComplete string) []string { } return res } + +// GetUninstallableCores is an helper function useful to autocomplete. +// It returns a list of cores which can be uninstalled +func GetUninstallableCores(toComplete string) []string { + inst := instance.CreateAndInit() // TODO optimize this: it does not make sense to create an instance everytime + + platforms, _ := core.GetPlatforms(&rpc.PlatformListRequest{ + Instance: inst, + UpdatableOnly: false, + All: false, + }) + var res []string + // transform the data structure for the completion + for _, i := range platforms { + res = append(res, i.GetId()) + } + return res +} diff --git a/cli/core/uninstall.go b/cli/core/uninstall.go index fb71468d84e..482f407cfb2 100644 --- a/cli/core/uninstall.go +++ b/cli/core/uninstall.go @@ -39,6 +39,9 @@ func initUninstallCommand() *cobra.Command { Example: " " + os.Args[0] + " core uninstall arduino:samd\n", Args: cobra.MinimumNArgs(1), Run: runUninstallCommand, + ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + return arguments.GetUninstallableCores(toComplete), cobra.ShellCompDirectiveDefault + }, } } diff --git a/i18n/data/en.po b/i18n/data/en.po index e711a4b11aa..bde6591389f 100644 --- a/i18n/data/en.po +++ b/i18n/data/en.po @@ -729,7 +729,7 @@ msgstr "Error during build: %v" msgid "Error during install: %v" msgstr "Error during install: %v" -#: cli/core/uninstall.go:68 +#: cli/core/uninstall.go:71 msgid "Error during uninstall: %v" msgstr "Error during uninstall: %v" @@ -1218,7 +1218,7 @@ msgstr "Invalid additional URL: %v" #: cli/core/download.go:55 #: cli/core/install.go:92 -#: cli/core/uninstall.go:51 +#: cli/core/uninstall.go:54 #: cli/core/upgrade.go:81 #: cli/lib/download.go:50 #: cli/lib/uninstall.go:51 @@ -1266,7 +1266,7 @@ msgstr "Invalid output format: %s" msgid "Invalid package index in %s" msgstr "Invalid package index in %s" -#: cli/core/uninstall.go:57 +#: cli/core/uninstall.go:60 msgid "Invalid parameter %s: version not allowed" msgstr "Invalid parameter %s: version not allowed" From fc82c12bf2d33d642ed83aca0df9918322e90435 Mon Sep 17 00:00:00 2001 From: Umberto Baldi Date: Wed, 6 Oct 2021 18:20:05 +0200 Subject: [PATCH 07/22] add completion for `core install` and `core download` --- cli/arguments/completion.go | 18 ++++++++++++++++++ cli/core/download.go | 3 +++ cli/core/install.go | 3 +++ i18n/data/en.po | 14 +++++++------- 4 files changed, 31 insertions(+), 7 deletions(-) diff --git a/cli/arguments/completion.go b/cli/arguments/completion.go index 89d123e0353..88783015285 100644 --- a/cli/arguments/completion.go +++ b/cli/arguments/completion.go @@ -107,3 +107,21 @@ func GetUninstallableCores(toComplete string) []string { } return res } + +// GetInstallableCores is an helper function useful to autocomplete. +// It returns a list of cores which can be installed/downloaded +func GetInstallableCores(toComplete string) []string { + inst := instance.CreateAndInit() // TODO optimize this: it does not make sense to create an instance everytime + + platforms, _ := core.PlatformSearch(&rpc.PlatformSearchRequest{ + Instance: inst, + SearchArgs: "", + AllVersions: false, + }) + var res []string + // transform the data structure for the completion + for _, i := range platforms.SearchOutput { + res = append(res, i.GetId()) + } + return res +} diff --git a/cli/core/download.go b/cli/core/download.go index 1ca0ab1e20f..041ca7d9898 100644 --- a/cli/core/download.go +++ b/cli/core/download.go @@ -41,6 +41,9 @@ func initDownloadCommand() *cobra.Command { " " + os.Args[0] + " core download arduino:samd@1.6.9 # " + tr("download a specific version (in this case 1.6.9)."), Args: cobra.MinimumNArgs(1), Run: runDownloadCommand, + ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + return arguments.GetInstallableCores(toComplete), cobra.ShellCompDirectiveDefault + }, } return downloadCommand } diff --git a/cli/core/install.go b/cli/core/install.go index d36fa5c753d..667e048c903 100644 --- a/cli/core/install.go +++ b/cli/core/install.go @@ -43,6 +43,9 @@ func initInstallCommand() *cobra.Command { " " + os.Args[0] + " core install arduino:samd@1.6.9", Args: cobra.MinimumNArgs(1), Run: runInstallCommand, + ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + return arguments.GetInstallableCores(toComplete), cobra.ShellCompDirectiveDefault + }, } AddPostInstallFlagsToCommand(installCommand) return installCommand diff --git a/i18n/data/en.po b/i18n/data/en.po index bde6591389f..ce1b6457f91 100644 --- a/i18n/data/en.po +++ b/i18n/data/en.po @@ -653,7 +653,7 @@ msgstr "Error creating sketch: %v" msgid "Error detecting boards: %v" msgstr "Error detecting boards: %v" -#: cli/core/download.go:68 +#: cli/core/download.go:71 #: cli/lib/download.go:62 msgid "Error downloading %[1]s: %[2]v" msgstr "Error downloading %[1]s: %[2]v" @@ -725,7 +725,7 @@ msgstr "Error during Upload: %v" msgid "Error during build: %v" msgstr "Error during build: %v" -#: cli/core/install.go:106 +#: cli/core/install.go:109 msgid "Error during install: %v" msgstr "Error during install: %v" @@ -1063,11 +1063,11 @@ msgstr "First message must contain debug request, not data" msgid "Flags:" msgstr "Flags:" -#: cli/core/install.go:59 +#: cli/core/install.go:62 msgid "Force run of post-install scripts (if the CLI is not running interactively)." msgstr "Force run of post-install scripts (if the CLI is not running interactively)." -#: cli/core/install.go:60 +#: cli/core/install.go:63 msgid "Force skip of post-install scripts (if the CLI is running interactively)." msgstr "Force skip of post-install scripts (if the CLI is running interactively)." @@ -1216,8 +1216,8 @@ msgstr "Invalid URL" msgid "Invalid additional URL: %v" msgstr "Invalid additional URL: %v" -#: cli/core/download.go:55 -#: cli/core/install.go:92 +#: cli/core/download.go:58 +#: cli/core/install.go:95 #: cli/core/uninstall.go:54 #: cli/core/upgrade.go:81 #: cli/lib/download.go:50 @@ -1984,7 +1984,7 @@ msgstr "The connected devices search timeout, raise it if your board doesn't sho msgid "The custom config file (if not specified the default will be used)." msgstr "The custom config file (if not specified the default will be used)." -#: cli/core/install.go:66 +#: cli/core/install.go:69 msgid "The flags --run-post-install and --skip-post-install can't be both set at the same time." msgstr "The flags --run-post-install and --skip-post-install can't be both set at the same time." From e79ae019a04702ca4244f437d6191bbb42f0dd01 Mon Sep 17 00:00:00 2001 From: Umberto Baldi Date: Wed, 6 Oct 2021 19:09:44 +0200 Subject: [PATCH 08/22] add completion for `lib uninstall` --- cli/arguments/completion.go | 21 +++++++++++++++++++++ cli/lib/uninstall.go | 4 ++++ i18n/data/en.po | 8 ++++---- 3 files changed, 29 insertions(+), 4 deletions(-) diff --git a/cli/arguments/completion.go b/cli/arguments/completion.go index 88783015285..1a81cffd2d8 100644 --- a/cli/arguments/completion.go +++ b/cli/arguments/completion.go @@ -8,6 +8,7 @@ import ( "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" rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1" ) @@ -125,3 +126,23 @@ func GetInstallableCores(toComplete string) []string { } return res } + +// GetUninstallableLibs is an helper function useful to autocomplete. +// It returns a list of libs which can be uninstalled +func GetUninstallableLibs(toComplete string) []string { + inst := instance.CreateAndInit() // TODO optimize this: it does not make sense to create an instance everytime + libs, _ := lib.LibraryList(context.Background(), &rpc.LibraryListRequest{ + Instance: inst, + All: false, + Updatable: false, + Name: "", + Fqbn: "", + }) + var res []string + // transform the data structure for the completion + for _, i := range libs.InstalledLibraries { + res = append(res, i.GetLibrary().Name) + } + return res +} + diff --git a/cli/lib/uninstall.go b/cli/lib/uninstall.go index 1a00da8a557..deaa6688ac4 100644 --- a/cli/lib/uninstall.go +++ b/cli/lib/uninstall.go @@ -20,6 +20,7 @@ import ( "fmt" "os" + "github.com/arduino/arduino-cli/cli/arguments" "github.com/arduino/arduino-cli/cli/errorcodes" "github.com/arduino/arduino-cli/cli/feedback" "github.com/arduino/arduino-cli/cli/instance" @@ -38,6 +39,9 @@ func initUninstallCommand() *cobra.Command { Example: " " + os.Args[0] + " lib uninstall AudioZero", Args: cobra.MinimumNArgs(1), Run: runUninstallCommand, + ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + return arguments.GetUninstallableLibs(toComplete), cobra.ShellCompDirectiveDefault + }, } return uninstallCommand } diff --git a/i18n/data/en.po b/i18n/data/en.po index ce1b6457f91..3600974a7ac 100644 --- a/i18n/data/en.po +++ b/i18n/data/en.po @@ -892,7 +892,7 @@ msgstr "Error serializing compilation database: %s" msgid "Error starting board discoveries" msgstr "Error starting board discoveries" -#: cli/lib/uninstall.go:62 +#: cli/lib/uninstall.go:66 msgid "Error uninstalling %[1]s: %[2]v" msgstr "Error uninstalling %[1]s: %[2]v" @@ -1221,7 +1221,7 @@ msgstr "Invalid additional URL: %v" #: cli/core/uninstall.go:54 #: cli/core/upgrade.go:81 #: cli/lib/download.go:50 -#: cli/lib/uninstall.go:51 +#: cli/lib/uninstall.go:55 msgid "Invalid argument passed: %v" msgstr "Invalid argument passed: %v" @@ -1302,7 +1302,7 @@ msgstr "LIBRARY" #: cli/lib/download.go:34 #: cli/lib/examples.go:39 #: cli/lib/search.go:39 -#: cli/lib/uninstall.go:35 +#: cli/lib/uninstall.go:36 msgid "LIBRARY_NAME" msgstr "LIBRARY_NAME" @@ -2105,8 +2105,8 @@ msgstr "Uninstalling %s: tool is no more required" msgid "Uninstalls one or more cores and corresponding tool dependencies if no longer used." msgstr "Uninstalls one or more cores and corresponding tool dependencies if no longer used." -#: cli/lib/uninstall.go:36 #: cli/lib/uninstall.go:37 +#: cli/lib/uninstall.go:38 msgid "Uninstalls one or more libraries." msgstr "Uninstalls one or more libraries." From 6d560b2112df5c55a291f62e0094e75913d5b641 Mon Sep 17 00:00:00 2001 From: Umberto Baldi Date: Thu, 7 Oct 2021 12:08:00 +0200 Subject: [PATCH 09/22] add completion for `lib install`, `lib download` --- cli/arguments/completion.go | 16 ++++++++++++++ cli/lib/download.go | 4 ++++ cli/lib/install.go | 4 ++++ i18n/data/en.po | 42 ++++++++++++++++++------------------- 4 files changed, 45 insertions(+), 21 deletions(-) diff --git a/cli/arguments/completion.go b/cli/arguments/completion.go index 1a81cffd2d8..ae0b6d2d8ff 100644 --- a/cli/arguments/completion.go +++ b/cli/arguments/completion.go @@ -146,3 +146,19 @@ func GetUninstallableLibs(toComplete string) []string { return res } +// GetInstallableLibs is an helper function useful to autocomplete. +// It returns a list of libs which can be installed/downloaded +func GetInstallableLibs(toComplete string) []string { + inst := instance.CreateAndInit() // TODO optimize this: it does not make sense to create an instance everytime + + libs, _ := lib.LibrarySearch(context.Background(), &rpc.LibrarySearchRequest{ + Instance: inst, + Query: "", // if no query is specified all the libs are returned + }) + var res []string + // transform the data structure for the completion + for _, i := range libs.Libraries { + res = append(res, i.Name) + } + return res +} diff --git a/cli/lib/download.go b/cli/lib/download.go index 861fa0592d7..4e0f6f3957b 100644 --- a/cli/lib/download.go +++ b/cli/lib/download.go @@ -20,6 +20,7 @@ import ( "fmt" "os" + "github.com/arduino/arduino-cli/cli/arguments" "github.com/arduino/arduino-cli/cli/errorcodes" "github.com/arduino/arduino-cli/cli/feedback" "github.com/arduino/arduino-cli/cli/instance" @@ -39,6 +40,9 @@ func initDownloadCommand() *cobra.Command { " " + os.Args[0] + " lib download AudioZero@1.0.0 # " + tr("for a specific version."), Args: cobra.MinimumNArgs(1), Run: runDownloadCommand, + ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + return arguments.GetInstallableLibs(toComplete), cobra.ShellCompDirectiveDefault + }, } return downloadCommand } diff --git a/cli/lib/install.go b/cli/lib/install.go index b8637951333..f7a3e1b6b9e 100644 --- a/cli/lib/install.go +++ b/cli/lib/install.go @@ -21,6 +21,7 @@ import ( "os" "strings" + "github.com/arduino/arduino-cli/cli/arguments" "github.com/arduino/arduino-cli/cli/errorcodes" "github.com/arduino/arduino-cli/cli/feedback" "github.com/arduino/arduino-cli/cli/globals" @@ -46,6 +47,9 @@ func initInstallCommand() *cobra.Command { " " + os.Args[0] + " lib install --zip-path /path/to/WiFi101.zip /path/to/ArduinoBLE.zip\n", Args: cobra.MinimumNArgs(1), Run: runInstallCommand, + ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + return arguments.GetInstallableLibs(toComplete), cobra.ShellCompDirectiveDefault + }, } installCommand.Flags().BoolVar(&installFlags.noDeps, "no-deps", false, tr("Do not install dependencies.")) installCommand.Flags().BoolVar(&installFlags.gitURL, "git-url", false, tr("Enter git url for libraries hosted on repositories")) diff --git a/i18n/data/en.po b/i18n/data/en.po index 3600974a7ac..2c488a0fbb6 100644 --- a/i18n/data/en.po +++ b/i18n/data/en.po @@ -83,11 +83,11 @@ msgstr "(hidden)" msgid "(legacy)" msgstr "(legacy)" -#: cli/lib/install.go:73 +#: cli/lib/install.go:77 msgid "--git-url and --zip-path are disabled by default, for more information see: %v" msgstr "--git-url and --zip-path are disabled by default, for more information see: %v" -#: cli/lib/install.go:76 +#: cli/lib/install.go:80 msgid "--git-url and --zip-path flags allow installing untrusted files, use it at your own risk." msgstr "--git-url and --zip-path flags allow installing untrusted files, use it at your own risk." @@ -186,7 +186,7 @@ msgid "Arduino core operations." msgstr "Arduino core operations." #: cli/lib/check_deps.go:50 -#: cli/lib/install.go:119 +#: cli/lib/install.go:123 msgid "Arguments error: %v" msgstr "Arguments error: %v" @@ -453,7 +453,7 @@ msgid "Couldn't determine program size" msgstr "Couldn't determine program size" #: cli/arguments/sketch.go:36 -#: cli/lib/install.go:99 +#: cli/lib/install.go:103 msgid "Couldn't get current working directory: %v" msgstr "Couldn't get current working directory: %v" @@ -553,7 +553,7 @@ msgstr "Disconnected" msgid "Display only the provided gRPC calls" msgstr "Display only the provided gRPC calls" -#: cli/lib/install.go:50 +#: cli/lib/install.go:54 msgid "Do not install dependencies." msgstr "Do not install dependencies." @@ -585,8 +585,8 @@ msgstr "Downloading packages" msgid "Downloads one or more cores and corresponding tool dependencies." msgstr "Downloads one or more cores and corresponding tool dependencies." -#: cli/lib/download.go:35 #: cli/lib/download.go:36 +#: cli/lib/download.go:37 msgid "Downloads one or more libraries without installing them." msgstr "Downloads one or more libraries without installing them." @@ -594,11 +594,11 @@ msgstr "Downloads one or more libraries without installing them." msgid "Enable debug logging of gRPC calls" msgstr "Enable debug logging of gRPC calls" -#: cli/lib/install.go:52 +#: cli/lib/install.go:56 msgid "Enter a path to zip file" msgstr "Enter a path to zip file" -#: cli/lib/install.go:51 +#: cli/lib/install.go:55 msgid "Enter git url for libraries hosted on repositories" msgstr "Enter git url for libraries hosted on repositories" @@ -654,7 +654,7 @@ msgid "Error detecting boards: %v" msgstr "Error detecting boards: %v" #: cli/core/download.go:71 -#: cli/lib/download.go:62 +#: cli/lib/download.go:66 msgid "Error downloading %[1]s: %[2]v" msgstr "Error downloading %[1]s: %[2]v" @@ -789,15 +789,15 @@ msgstr "Error in FQBN: %s" msgid "Error initializing instance: %v" msgstr "Error initializing instance: %v" -#: cli/lib/install.go:132 +#: cli/lib/install.go:136 msgid "Error installing %s: %v" msgstr "Error installing %s: %v" -#: cli/lib/install.go:110 +#: cli/lib/install.go:114 msgid "Error installing Git Library: %v" msgstr "Error installing Git Library: %v" -#: cli/lib/install.go:87 +#: cli/lib/install.go:91 msgid "Error installing Zip Library: %v" msgstr "Error installing Zip Library: %v" @@ -1183,8 +1183,8 @@ msgstr "Installing platform %s" msgid "Installs one or more cores and corresponding tool dependencies." msgstr "Installs one or more cores and corresponding tool dependencies." -#: cli/lib/install.go:40 #: cli/lib/install.go:41 +#: cli/lib/install.go:42 msgid "Installs one or more specified libraries into the system." msgstr "Installs one or more specified libraries into the system." @@ -1220,7 +1220,7 @@ msgstr "Invalid additional URL: %v" #: cli/core/install.go:95 #: cli/core/uninstall.go:54 #: cli/core/upgrade.go:81 -#: cli/lib/download.go:50 +#: cli/lib/download.go:54 #: cli/lib/uninstall.go:55 msgid "Invalid argument passed: %v" msgstr "Invalid argument passed: %v" @@ -1295,11 +1295,11 @@ msgid "LIBNAME" msgstr "LIBNAME" #: cli/lib/check_deps.go:34 -#: cli/lib/install.go:39 +#: cli/lib/install.go:40 msgid "LIBRARY" msgstr "LIBRARY" -#: cli/lib/download.go:34 +#: cli/lib/download.go:35 #: cli/lib/examples.go:39 #: cli/lib/search.go:39 #: cli/lib/uninstall.go:36 @@ -2285,7 +2285,7 @@ msgid "VERSION" msgstr "VERSION" #: cli/lib/check_deps.go:34 -#: cli/lib/install.go:39 +#: cli/lib/install.go:40 msgid "VERSION_NUMBER" msgstr "VERSION_NUMBER" @@ -2624,18 +2624,18 @@ msgstr "flags" msgid "following possible symlink %[1]s: %[2]s" msgstr "following possible symlink %[1]s: %[2]s" -#: cli/lib/download.go:39 +#: cli/lib/download.go:40 msgid "for a specific version." msgstr "for a specific version." #: cli/lib/check_deps.go:38 -#: cli/lib/download.go:38 -#: cli/lib/install.go:43 +#: cli/lib/download.go:39 +#: cli/lib/install.go:44 msgid "for the latest version." msgstr "for the latest version." #: cli/lib/check_deps.go:39 -#: cli/lib/install.go:44 +#: cli/lib/install.go:45 msgid "for the specific version." msgstr "for the specific version." From 3486d94db83c7a73f1f16dc0a3c524ad4310d961 Mon Sep 17 00:00:00 2001 From: Umberto Baldi Date: Thu, 7 Oct 2021 12:08:43 +0200 Subject: [PATCH 10/22] add completion for `lib examples` --- cli/lib/examples.go | 3 +++ i18n/data/en.po | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/cli/lib/examples.go b/cli/lib/examples.go index f35884cbc88..8f34e30fe60 100644 --- a/cli/lib/examples.go +++ b/cli/lib/examples.go @@ -42,6 +42,9 @@ func initExamplesCommand() *cobra.Command { Example: " " + os.Args[0] + " lib examples Wire", Args: cobra.MaximumNArgs(1), Run: runExamplesCommand, + ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + return arguments.GetUninstallableLibs(toComplete), cobra.ShellCompDirectiveDefault + }, } examplesCommand.Flags().StringVarP(&examplesFlags.fqbn, "fqbn", "b", "", tr("Show libraries for the specified board FQBN.")) examplesCommand.RegisterFlagCompletionFunc("fqbn", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { diff --git a/i18n/data/en.po b/i18n/data/en.po index 2c488a0fbb6..16787266340 100644 --- a/i18n/data/en.po +++ b/i18n/data/en.po @@ -774,7 +774,7 @@ msgstr "Error getting current directory for compilation database: %s" msgid "Error getting information for library %s" msgstr "Error getting information for library %s" -#: cli/lib/examples.go:73 +#: cli/lib/examples.go:76 msgid "Error getting libraries info: %v" msgstr "Error getting libraries info: %v" @@ -977,7 +977,7 @@ msgstr "Error: invalid source code overrides data file: %v" msgid "Event" msgstr "Event" -#: cli/lib/examples.go:122 +#: cli/lib/examples.go:125 msgid "Examples for library %s" msgstr "Examples for library %s" @@ -1481,7 +1481,7 @@ msgstr "No boards found." msgid "No colon in first line of depfile" msgstr "No colon in first line of depfile" -#: cli/lib/examples.go:107 +#: cli/lib/examples.go:110 msgid "No libraries found." msgstr "No libraries found." @@ -1848,7 +1848,7 @@ msgstr "Show full board details" msgid "Show information about a board, in particular if the board has options to be specified in the FQBN." msgstr "Show information about a board, in particular if the board has options to be specified in the FQBN." -#: cli/lib/examples.go:46 +#: cli/lib/examples.go:49 #: cli/lib/list.go:49 msgid "Show libraries for the specified board FQBN." msgstr "Show libraries for the specified board FQBN." From 28dfdc1583b59b16fec8cda450efdb2cc1666e2a Mon Sep 17 00:00:00 2001 From: Umberto Baldi Date: Thu, 7 Oct 2021 13:01:32 +0200 Subject: [PATCH 11/22] add completion for `config add`, `config remove`, `config delete` and `config set` --- cli/config/add.go | 3 +++ cli/config/delete.go | 3 +++ cli/config/remove.go | 3 +++ cli/config/set.go | 3 +++ i18n/data/en.po | 18 +++++++++--------- 5 files changed, 21 insertions(+), 9 deletions(-) diff --git a/cli/config/add.go b/cli/config/add.go index da5096fa5f9..351118d7e95 100644 --- a/cli/config/add.go +++ b/cli/config/add.go @@ -35,6 +35,9 @@ func initAddCommand() *cobra.Command { " " + os.Args[0] + " config add board_manager.additional_urls https://example.com/package_example_index.json https://another-url.com/package_another_index.json\n", Args: cobra.MinimumNArgs(2), Run: runAddCommand, + ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + return configuration.Settings.AllKeys(), cobra.ShellCompDirectiveDefault + }, } return addCommand } diff --git a/cli/config/delete.go b/cli/config/delete.go index 8b3c2693e4c..370cd33da9c 100644 --- a/cli/config/delete.go +++ b/cli/config/delete.go @@ -36,6 +36,9 @@ func initDeleteCommand() *cobra.Command { " " + os.Args[0] + " config delete board_manager.additional_urls", Args: cobra.ExactArgs(1), Run: runDeleteCommand, + ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + return configuration.Settings.AllKeys(), cobra.ShellCompDirectiveDefault + }, } return addCommand } diff --git a/cli/config/remove.go b/cli/config/remove.go index c5181f2bc63..0d2cd94a1ce 100644 --- a/cli/config/remove.go +++ b/cli/config/remove.go @@ -35,6 +35,9 @@ func initRemoveCommand() *cobra.Command { " " + os.Args[0] + " config remove board_manager.additional_urls https://example.com/package_example_index.json https://another-url.com/package_another_index.json\n", Args: cobra.MinimumNArgs(2), Run: runRemoveCommand, + ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + return configuration.Settings.AllKeys(), cobra.ShellCompDirectiveDefault + }, } return addCommand } diff --git a/cli/config/set.go b/cli/config/set.go index afb07928280..7e849f0aabd 100644 --- a/cli/config/set.go +++ b/cli/config/set.go @@ -38,6 +38,9 @@ func initSetCommand() *cobra.Command { " " + os.Args[0] + " config set board_manager.additional_urls https://example.com/package_example_index.json https://another-url.com/package_another_index.json", Args: cobra.MinimumNArgs(2), Run: runSetCommand, + ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + return configuration.Settings.AllKeys(), cobra.ShellCompDirectiveDefault + }, } return addCommand } diff --git a/i18n/data/en.po b/i18n/data/en.po index 16787266340..1b8e25d0e76 100644 --- a/i18n/data/en.po +++ b/i18n/data/en.po @@ -264,7 +264,7 @@ msgstr "Can't find dependencies for platform %s" msgid "Can't open sketch" msgstr "Can't open sketch" -#: cli/config/set.go:54 +#: cli/config/set.go:57 msgid "Can't set multiple values in key %v" msgstr "Can't set multiple values in key %v" @@ -272,9 +272,9 @@ msgstr "Can't set multiple values in key %v" msgid "Can't use both --dest-file and --dest-dir flags at the same time." msgstr "Can't use both --dest-file and --dest-dir flags at the same time." -#: cli/config/add.go:60 -#: cli/config/delete.go:67 -#: cli/config/remove.go:69 +#: cli/config/add.go:63 +#: cli/config/delete.go:70 +#: cli/config/remove.go:72 msgid "Can't write config file: %v" msgstr "Can't write config file: %v" @@ -1822,7 +1822,7 @@ msgstr "Sets a setting value." msgid "Sets where to save the configuration file." msgstr "Sets where to save the configuration file." -#: cli/config/delete.go:57 +#: cli/config/delete.go:60 #: cli/config/validate.go:45 msgid "Settings key doesn't exist" msgstr "Settings key doesn't exist" @@ -1988,13 +1988,13 @@ msgstr "The custom config file (if not specified the default will be used)." msgid "The flags --run-post-install and --skip-post-install can't be both set at the same time." msgstr "The flags --run-post-install and --skip-post-install can't be both set at the same time." -#: cli/config/add.go:51 +#: cli/config/add.go:54 msgid "The key '%[1]v' is not a list of items, can't add to it.\n" "Maybe use '%[2]s'?" msgstr "The key '%[1]v' is not a list of items, can't add to it.\n" "Maybe use '%[2]s'?" -#: cli/config/remove.go:51 +#: cli/config/remove.go:54 msgid "The key '%[1]v' is not a list of items, can't remove from it.\n" "Maybe use '%[2]s'?" msgstr "The key '%[1]v' is not a list of items, can't remove from it.\n" @@ -2347,7 +2347,7 @@ msgstr "Writes current configuration to a configuration file." msgid "Writes current configuration to the configuration file in the data directory." msgstr "Writes current configuration to the configuration file in the data directory." -#: cli/config/set.go:76 +#: cli/config/set.go:79 msgid "Writing config file: %v" msgstr "Writing config file: %v" @@ -2568,7 +2568,7 @@ msgstr "encoding sketch metadata: %s" msgid "error opening serial monitor" msgstr "error opening serial monitor" -#: cli/config/set.go:68 +#: cli/config/set.go:71 msgid "error parsing value: %v" msgstr "error parsing value: %v" From 27d300c108581620311eb121a52a7fbf0ec50f51 Mon Sep 17 00:00:00 2001 From: Umberto Baldi Date: Thu, 7 Oct 2021 16:39:33 +0200 Subject: [PATCH 12/22] add completion for `lib deps` --- cli/lib/check_deps.go | 4 ++++ i18n/data/en.po | 20 ++++++++++---------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/cli/lib/check_deps.go b/cli/lib/check_deps.go index 7dce28b0a2c..9a91b63aa8a 100644 --- a/cli/lib/check_deps.go +++ b/cli/lib/check_deps.go @@ -20,6 +20,7 @@ import ( "fmt" "os" + "github.com/arduino/arduino-cli/cli/arguments" "github.com/arduino/arduino-cli/cli/errorcodes" "github.com/arduino/arduino-cli/cli/feedback" "github.com/arduino/arduino-cli/cli/instance" @@ -39,6 +40,9 @@ func initDepsCommand() *cobra.Command { " " + os.Args[0] + " lib deps AudioZero@1.0.0 # " + tr("for the specific version."), Args: cobra.ExactArgs(1), Run: runDepsCommand, + ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + return arguments.GetUninstallableLibs(toComplete), cobra.ShellCompDirectiveDefault + }, } return depsCommand } diff --git a/i18n/data/en.po b/i18n/data/en.po index 1b8e25d0e76..fcedf1089dd 100644 --- a/i18n/data/en.po +++ b/i18n/data/en.po @@ -9,7 +9,7 @@ msgstr "%[1]s %[2]s Version: %[3]s Commit: %[4]s Date: %[5]s" msgid "%[1]s folder is no longer supported! See %[2]s for more information" msgstr "%[1]s folder is no longer supported! See %[2]s for more information" -#: cli/lib/check_deps.go:96 +#: cli/lib/check_deps.go:100 msgid "%[1]s is required but %[2]s is currently installed." msgstr "%[1]s is required but %[2]s is currently installed." @@ -45,7 +45,7 @@ msgstr "%s downloaded" msgid "%s installed" msgstr "%s installed" -#: cli/lib/check_deps.go:93 +#: cli/lib/check_deps.go:97 msgid "%s is already installed." msgstr "%s is already installed." @@ -57,7 +57,7 @@ msgstr "%s is not a directory" msgid "%s is not managed by package manager" msgstr "%s is not managed by package manager" -#: cli/lib/check_deps.go:90 +#: cli/lib/check_deps.go:94 msgid "%s must be installed." msgstr "%s must be installed." @@ -185,7 +185,7 @@ msgstr "Arduino configuration commands." msgid "Arduino core operations." msgstr "Arduino core operations." -#: cli/lib/check_deps.go:50 +#: cli/lib/check_deps.go:54 #: cli/lib/install.go:123 msgid "Arguments error: %v" msgstr "Arguments error: %v" @@ -340,8 +340,8 @@ msgstr "Cannot upgrade platform" msgid "Category: %s" msgstr "Category: %s" -#: cli/lib/check_deps.go:35 #: cli/lib/check_deps.go:36 +#: cli/lib/check_deps.go:37 msgid "Check dependencies status for the specified library." msgstr "Check dependencies status for the specified library." @@ -841,7 +841,7 @@ msgstr "Error reading sketch files" msgid "Error resolving FQBN: {0}" msgstr "Error resolving FQBN: {0}" -#: cli/lib/check_deps.go:60 +#: cli/lib/check_deps.go:64 msgid "Error resolving dependencies for %[1]s: %[2]s" msgstr "Error resolving dependencies for %[1]s: %[2]s" @@ -1294,7 +1294,7 @@ msgstr "Just produce the compilation database, without actually compiling." msgid "LIBNAME" msgstr "LIBNAME" -#: cli/lib/check_deps.go:34 +#: cli/lib/check_deps.go:35 #: cli/lib/install.go:40 msgid "LIBRARY" msgstr "LIBRARY" @@ -2284,7 +2284,7 @@ msgstr "Using previously compiled file: {0}" msgid "VERSION" msgstr "VERSION" -#: cli/lib/check_deps.go:34 +#: cli/lib/check_deps.go:35 #: cli/lib/install.go:40 msgid "VERSION_NUMBER" msgstr "VERSION_NUMBER" @@ -2628,13 +2628,13 @@ msgstr "following possible symlink %[1]s: %[2]s" msgid "for a specific version." msgstr "for a specific version." -#: cli/lib/check_deps.go:38 +#: cli/lib/check_deps.go:39 #: cli/lib/download.go:39 #: cli/lib/install.go:44 msgid "for the latest version." msgstr "for the latest version." -#: cli/lib/check_deps.go:39 +#: cli/lib/check_deps.go:40 #: cli/lib/install.go:45 msgid "for the specific version." msgstr "for the specific version." From d7be8140efda8800f405cdb88189ba32cd2bf4c9 Mon Sep 17 00:00:00 2001 From: Umberto Baldi Date: Tue, 12 Oct 2021 17:38:36 +0200 Subject: [PATCH 13/22] add tests --- test/test_completion.py | 110 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 110 insertions(+) diff --git a/test/test_completion.py b/test/test_completion.py index d84a4d05864..c36115f04de 100644 --- a/test/test_completion.py +++ b/test/test_completion.py @@ -14,6 +14,7 @@ # a commercial license, send an email to license@arduino.cc. +# test if the completion command behaves correctly def test_completion_no_args(run_command): result = run_command(["completion"]) assert not result.ok @@ -85,3 +86,112 @@ def test_completion_powershell_no_desc(run_command): assert not result.ok assert result.stdout == "" assert "Error: command description is not supported by powershell" in result.stderr + + +# test if the completion suggestions returned are meaningful +# we use the __complete hidden command +# https://github.com/spf13/cobra/blob/master/shell_completions.md#debugging + +# test static completions +def test_static_completions(run_command): + result = run_command( + [ + "__complete", + "--format", + "", + ] + ) + assert "json" in result.stdout + result = run_command( + [ + "__complete", + "--log-format", + "", + ] + ) + assert "json" in result.stdout + result = run_command( + [ + "__complete", + "--log-level", + "", + ] + ) + assert "trace" in result.stdout + + +# here we test if the completions coming from the core are working +def test_config_completion(run_command): + result = run_command(["__complete", "config", "add", ""]) + assert "board_manager.additional_urls" in result.stdout + result = run_command(["__complete", "config", "remove", ""]) + assert "board_manager.additional_urls" in result.stdout + result = run_command(["__complete", "config", "delete", ""]) + assert "board_manager.additional_urls" in result.stdout + result = run_command(["__complete", "config", "set", ""]) + assert "board_manager.additional_urls" in result.stdout + + +# here we test if the completions coming from the libs are working +def test_lib_completion(run_command): + assert run_command(["lib", "update-index"]) + result = run_command(["__complete", "lib", "install", ""]) + assert "WiFi101" in result.stdout + result = run_command(["__complete", "lib", "download", ""]) + assert "WiFi101" in result.stdout + result = run_command(["__complete", "lib", "uninstall", ""]) + assert "WiFi101" not in result.stdout # not yet installed + + assert run_command(["lib", "install", "WiFi101"]) + result = run_command(["__complete", "lib", "uninstall", ""]) + assert "WiFi101" in result.stdout + result = run_command(["__complete", "lib", "examples", ""]) + assert "WiFi101" in result.stdout + result = run_command(["__complete", "lib", "deps", ""]) + assert "WiFi101" in result.stdout + + +# here we test if the completions coming from the core are working +def test_core_completion(run_command): + assert run_command(["core", "update-index"]) + result = run_command(["__complete", "core", "install", ""]) + assert "arduino:avr" in result.stdout + result = run_command(["__complete", "core", "download", ""]) + assert "arduino:avr" in result.stdout + result = run_command(["__complete", "core", "uninstall", ""]) + assert "arduino:avr" not in result.stdout + + # we install a core because the provided completions comes from it + assert run_command(["core", "install", "arduino:avr@1.8.3"]) + + result = run_command(["__complete", "core", "uninstall", ""]) + assert "arduino:avr" in result.stdout + + result = run_command(["__complete", "board", "details", "-b", ""]) + assert "arduino:avr:uno" in result.stdout + result = run_command(["__complete", "burn-bootloader", "-b", ""]) + assert "arduino:avr:uno" in result.stdout + result = run_command(["__complete", "compile", "-b", ""]) + assert "arduino:avr:uno" in result.stdout + result = run_command(["__complete", "debug", "-b", ""]) + assert "arduino:avr:uno" in result.stdout + result = run_command(["__complete", "lib", "examples", "-b", ""]) + assert "arduino:avr:uno" in result.stdout + result = run_command(["__complete", "upload", "-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", ""]) + assert "network" in result.stdout + result = run_command(["__complete", "debug", "-l", ""]) + assert "network" in result.stdout + result = run_command(["__complete", "upload", "-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", ""]) + assert "atmel_ice" in result.stdout + result = run_command(["__complete", "debug", "-P", ""]) + assert "atmel_ice" in result.stdout + result = run_command(["__complete", "upload", "-P", ""]) + assert "atmel_ice" in result.stdout From 4559c250966a37358f528e977130a3ac9af4bcce Mon Sep 17 00:00:00 2001 From: Umberto Baldi Date: Wed, 13 Oct 2021 11:12:44 +0200 Subject: [PATCH 14/22] enhance the completion for `config add` and `config remove` --- cli/config/add.go | 2 +- cli/config/config.go | 16 ++++++++++++++++ cli/config/remove.go | 2 +- i18n/data/en.po | 2 +- 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/cli/config/add.go b/cli/config/add.go index 351118d7e95..dbdf74a47c2 100644 --- a/cli/config/add.go +++ b/cli/config/add.go @@ -36,7 +36,7 @@ func initAddCommand() *cobra.Command { Args: cobra.MinimumNArgs(2), Run: runAddCommand, ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - return configuration.Settings.AllKeys(), cobra.ShellCompDirectiveDefault + return GetConfigurationKeys(toComplete), cobra.ShellCompDirectiveDefault }, } return addCommand diff --git a/cli/config/config.go b/cli/config/config.go index b91a0ddb7d5..9e75f08e7e8 100644 --- a/cli/config/config.go +++ b/cli/config/config.go @@ -17,7 +17,9 @@ package config import ( "os" + "reflect" + "github.com/arduino/arduino-cli/configuration" "github.com/arduino/arduino-cli/i18n" "github.com/spf13/cobra" ) @@ -41,3 +43,17 @@ func NewCommand() *cobra.Command { return configCommand } + +// GetConfigurationKeys is an helper function useful to autocomplete. +// It returns a list of configuration keys which can be changed +func GetConfigurationKeys(toComplete string) []string { + var res []string + keys := configuration.Settings.AllKeys() + for _, key := range keys { + kind, _ := typeOf(key) + if kind == reflect.Slice { + res = append(res, key) + } + } + return res +} diff --git a/cli/config/remove.go b/cli/config/remove.go index 0d2cd94a1ce..6317005e0d0 100644 --- a/cli/config/remove.go +++ b/cli/config/remove.go @@ -36,7 +36,7 @@ func initRemoveCommand() *cobra.Command { Args: cobra.MinimumNArgs(2), Run: runRemoveCommand, ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - return configuration.Settings.AllKeys(), cobra.ShellCompDirectiveDefault + return GetConfigurationKeys(toComplete), cobra.ShellCompDirectiveDefault }, } return addCommand diff --git a/i18n/data/en.po b/i18n/data/en.po index fcedf1089dd..0c7ce9bf8e8 100644 --- a/i18n/data/en.po +++ b/i18n/data/en.po @@ -176,7 +176,7 @@ msgstr "Arduino cache commands." msgid "Arduino commands about libraries." msgstr "Arduino commands about libraries." -#: cli/config/config.go:31 +#: cli/config/config.go:33 msgid "Arduino configuration commands." msgstr "Arduino configuration commands." From 6b1a01c4146b714f76e12594bd5495881e84a436 Mon Sep 17 00:00:00 2001 From: Umberto Baldi Date: Wed, 13 Oct 2021 12:09:28 +0200 Subject: [PATCH 15/22] add description completion suggestion for core, lib, fqbn, programmer --- cli/arguments/completion.go | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/cli/arguments/completion.go b/cli/arguments/completion.go index ae0b6d2d8ff..355937f8d7f 100644 --- a/cli/arguments/completion.go +++ b/cli/arguments/completion.go @@ -25,8 +25,8 @@ func GetInstalledBoards(toComplete string) []string { }) var res []string // transform the data structure for the completion - for _, i := range list.GetBoards() { - res = append(res, i.Fqbn) + for _, i := range list.Boards { + res = append(res, i.Fqbn+"\t"+i.Name) } return res } @@ -71,21 +71,19 @@ func GetInstalledProgrammers(toComplete string) []string { IncludeHiddenBoards: false, }) - // use this strange map because it should be more optimized - // we use only the key and not the value because we do not need it - installedProgrammers := make(map[string]struct{}) - for _, i := range list.GetBoards() { + installedProgrammers := make(map[string]string) + for _, i := range list.Boards { fqbn, _ := cores.ParseFQBN(i.Fqbn) _, boardPlatform, _, _, _, _ := pm.ResolveFQBN(fqbn) - for programmerID := range boardPlatform.Programmers { - installedProgrammers[programmerID] = struct{}{} + for programmerID, programmer := range boardPlatform.Programmers { + installedProgrammers[programmerID] = programmer.Name } } res := make([]string, len(installedProgrammers)) i := 0 - for k := range installedProgrammers { - res[i] = k + for programmerID := range installedProgrammers { + res[i] = programmerID + "\t" + installedProgrammers[programmerID] i++ } return res @@ -104,7 +102,7 @@ func GetUninstallableCores(toComplete string) []string { var res []string // transform the data structure for the completion for _, i := range platforms { - res = append(res, i.GetId()) + res = append(res, i.Id+"\t"+i.Name) } return res } @@ -122,7 +120,7 @@ func GetInstallableCores(toComplete string) []string { var res []string // transform the data structure for the completion for _, i := range platforms.SearchOutput { - res = append(res, i.GetId()) + res = append(res, i.Id+"\t"+i.Name) } return res } @@ -141,7 +139,7 @@ func GetUninstallableLibs(toComplete string) []string { var res []string // transform the data structure for the completion for _, i := range libs.InstalledLibraries { - res = append(res, i.GetLibrary().Name) + res = append(res, i.Library.Name+"\t"+i.Library.Sentence) } return res } @@ -158,7 +156,7 @@ func GetInstallableLibs(toComplete string) []string { var res []string // transform the data structure for the completion for _, i := range libs.Libraries { - res = append(res, i.Name) + res = append(res, i.Name+"\t"+i.Latest.Sentence) } return res } From 5462031a30c5afba252cad7e61a18a46dd121242 Mon Sep 17 00:00:00 2001 From: Umberto Baldi Date: Wed, 13 Oct 2021 15:52:05 +0200 Subject: [PATCH 16/22] add completion also for `-p` or `--port` flag --- cli/arguments/completion.go | 17 +++++++++++++++++ cli/arguments/port.go | 3 +++ i18n/data/en.po | 6 +++--- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/cli/arguments/completion.go b/cli/arguments/completion.go index 355937f8d7f..82e04642330 100644 --- a/cli/arguments/completion.go +++ b/cli/arguments/completion.go @@ -160,3 +160,20 @@ func GetInstallableLibs(toComplete string) []string { } return res } + +// GetConnectedBoards is an helper function useful to autocomplete. +// It returns a list of boards which are currently connected +// Obviously it does not suggests network ports because of the timeout +func GetConnectedBoards(toComplete string) []string { + inst := instance.CreateAndInit() // TODO optimize this: it does not make sense to create an instance everytime + + list, _ := board.List(&rpc.BoardListRequest{ + Instance: inst, + }) + var res []string + // transform the data structure for the completion + for _, i := range list { + res = append(res, i.Port.Address) + } + return res +} diff --git a/cli/arguments/port.go b/cli/arguments/port.go index 46c62b6d7fb..a13aded69ad 100644 --- a/cli/arguments/port.go +++ b/cli/arguments/port.go @@ -42,6 +42,9 @@ type Port struct { // AddToCommand adds the flags used to set port and protocol to the specified Command func (p *Port) AddToCommand(cmd *cobra.Command) { cmd.Flags().StringVarP(&p.address, "port", "p", "", tr("Upload port address, e.g.: COM3 or /dev/ttyACM2")) + cmd.RegisterFlagCompletionFunc("port", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + return GetConnectedBoards(toComplete), cobra.ShellCompDirectiveDefault + }) cmd.Flags().StringVarP(&p.protocol, "protocol", "l", "", tr("Upload port protocol, e.g: serial")) cmd.RegisterFlagCompletionFunc("protocol", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { return GetInstalledProtocols(toComplete), cobra.ShellCompDirectiveDefault diff --git a/i18n/data/en.po b/i18n/data/en.po index 0c7ce9bf8e8..91c08d419e1 100644 --- a/i18n/data/en.po +++ b/i18n/data/en.po @@ -1418,7 +1418,7 @@ msgstr "Low memory available, stability problems may occur." msgid "Maintainer: %s" msgstr "Maintainer: %s" -#: cli/arguments/port.go:49 +#: cli/arguments/port.go:52 msgid "Max time to wait for port discovery, e.g.: 30s, 1m" msgstr "Max time to wait for port discovery, e.g.: 30s, 1m" @@ -2201,7 +2201,7 @@ msgstr "Upload port address, e.g.: COM3 or /dev/ttyACM2" msgid "Upload port found on %s" msgstr "Upload port found on %s" -#: cli/arguments/port.go:45 +#: cli/arguments/port.go:48 msgid "Upload port protocol, e.g: serial" msgstr "Upload port protocol, e.g: serial" @@ -3031,7 +3031,7 @@ msgstr "pluggable discovery already added: %s" msgid "port" msgstr "port" -#: cli/arguments/port.go:125 +#: cli/arguments/port.go:128 msgid "port not found: %[1]s %[2]s" msgstr "port not found: %[1]s %[2]s" From fe2cf6522809e15aaa7cef3744f4b5c3e5e97e93 Mon Sep 17 00:00:00 2001 From: Umberto Baldi Date: Wed, 13 Oct 2021 17:26:50 +0200 Subject: [PATCH 17/22] remove the `toComplete` parameter from all the completion functions as of now this parameter is useless because if a string is typed in the terminal it cannot be swapped with a different one. For example if I write `arduino-cli compile -b avr` the completion function returns all elements starting with `arduino:avr...`. So the completions are not showed because they cannot be swapped with a string that starts differently. The only shell which seems to support this seems to be zsh --- cli/arguments/completion.go | 16 ++++++++-------- cli/arguments/port.go | 4 ++-- cli/board/details.go | 2 +- cli/burnbootloader/burnbootloader.go | 4 ++-- cli/compile/compile.go | 4 ++-- cli/config/add.go | 2 +- cli/config/config.go | 2 +- cli/config/remove.go | 2 +- cli/core/download.go | 2 +- cli/core/install.go | 2 +- cli/core/uninstall.go | 2 +- cli/debug/debug.go | 4 ++-- cli/lib/check_deps.go | 2 +- cli/lib/download.go | 2 +- cli/lib/examples.go | 4 ++-- cli/lib/install.go | 2 +- cli/lib/uninstall.go | 2 +- cli/upload/upload.go | 4 ++-- 18 files changed, 31 insertions(+), 31 deletions(-) diff --git a/cli/arguments/completion.go b/cli/arguments/completion.go index 82e04642330..89ff7b72495 100644 --- a/cli/arguments/completion.go +++ b/cli/arguments/completion.go @@ -15,7 +15,7 @@ import ( // GetInstalledBoards is an helper function useful to autocomplete. // It returns a list of fqbn // it's taken from cli/board/listall.go -func GetInstalledBoards(toComplete string) []string { +func GetInstalledBoards() []string { inst := instance.CreateAndInit() // TODO optimize this: it does not make sense to create an instance everytime list, _ := board.ListAll(context.Background(), &rpc.BoardListAllRequest{ @@ -33,7 +33,7 @@ func GetInstalledBoards(toComplete string) []string { // GetInstalledProtocols is an helper function useful to autocomplete. // It returns a list of protocols available based on the installed boards -func GetInstalledProtocols(toComplete string) []string { +func GetInstalledProtocols() []string { inst := instance.CreateAndInit() // TODO optimize this: it does not make sense to create an instance everytime pm := commands.GetPackageManager(inst.Id) boards := pm.InstalledBoards() @@ -60,7 +60,7 @@ func GetInstalledProtocols(toComplete string) []string { // GetInstalledProgrammers is an helper function useful to autocomplete. // It returns a list of programmers available based on the installed boards -func GetInstalledProgrammers(toComplete string) []string { +func GetInstalledProgrammers() []string { inst := instance.CreateAndInit() // TODO optimize this: it does not make sense to create an instance everytime pm := commands.GetPackageManager(inst.Id) @@ -91,7 +91,7 @@ func GetInstalledProgrammers(toComplete string) []string { // GetUninstallableCores is an helper function useful to autocomplete. // It returns a list of cores which can be uninstalled -func GetUninstallableCores(toComplete string) []string { +func GetUninstallableCores() []string { inst := instance.CreateAndInit() // TODO optimize this: it does not make sense to create an instance everytime platforms, _ := core.GetPlatforms(&rpc.PlatformListRequest{ @@ -109,7 +109,7 @@ func GetUninstallableCores(toComplete string) []string { // GetInstallableCores is an helper function useful to autocomplete. // It returns a list of cores which can be installed/downloaded -func GetInstallableCores(toComplete string) []string { +func GetInstallableCores() []string { inst := instance.CreateAndInit() // TODO optimize this: it does not make sense to create an instance everytime platforms, _ := core.PlatformSearch(&rpc.PlatformSearchRequest{ @@ -127,7 +127,7 @@ func GetInstallableCores(toComplete string) []string { // GetUninstallableLibs is an helper function useful to autocomplete. // It returns a list of libs which can be uninstalled -func GetUninstallableLibs(toComplete string) []string { +func GetUninstallableLibs() []string { inst := instance.CreateAndInit() // TODO optimize this: it does not make sense to create an instance everytime libs, _ := lib.LibraryList(context.Background(), &rpc.LibraryListRequest{ Instance: inst, @@ -146,7 +146,7 @@ func GetUninstallableLibs(toComplete string) []string { // GetInstallableLibs is an helper function useful to autocomplete. // It returns a list of libs which can be installed/downloaded -func GetInstallableLibs(toComplete string) []string { +func GetInstallableLibs() []string { inst := instance.CreateAndInit() // TODO optimize this: it does not make sense to create an instance everytime libs, _ := lib.LibrarySearch(context.Background(), &rpc.LibrarySearchRequest{ @@ -164,7 +164,7 @@ func GetInstallableLibs(toComplete string) []string { // GetConnectedBoards is an helper function useful to autocomplete. // It returns a list of boards which are currently connected // Obviously it does not suggests network ports because of the timeout -func GetConnectedBoards(toComplete string) []string { +func GetConnectedBoards() []string { inst := instance.CreateAndInit() // TODO optimize this: it does not make sense to create an instance everytime list, _ := board.List(&rpc.BoardListRequest{ diff --git a/cli/arguments/port.go b/cli/arguments/port.go index a13aded69ad..c723335efcd 100644 --- a/cli/arguments/port.go +++ b/cli/arguments/port.go @@ -43,11 +43,11 @@ type Port struct { func (p *Port) AddToCommand(cmd *cobra.Command) { cmd.Flags().StringVarP(&p.address, "port", "p", "", tr("Upload port address, e.g.: COM3 or /dev/ttyACM2")) cmd.RegisterFlagCompletionFunc("port", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - return GetConnectedBoards(toComplete), cobra.ShellCompDirectiveDefault + return GetConnectedBoards(), cobra.ShellCompDirectiveDefault }) cmd.Flags().StringVarP(&p.protocol, "protocol", "l", "", tr("Upload port protocol, e.g: serial")) cmd.RegisterFlagCompletionFunc("protocol", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - return GetInstalledProtocols(toComplete), cobra.ShellCompDirectiveDefault + return GetInstalledProtocols(), cobra.ShellCompDirectiveDefault }) cmd.Flags().DurationVar(&p.timeout, "discovery-timeout", 5*time.Second, tr("Max time to wait for port discovery, e.g.: 30s, 1m")) } diff --git a/cli/board/details.go b/cli/board/details.go index 4ba75dcc451..abe5234ab3f 100644 --- a/cli/board/details.go +++ b/cli/board/details.go @@ -50,7 +50,7 @@ func initDetailsCommand() *cobra.Command { detailsCommand.Flags().BoolVarP(&showFullDetails, "full", "f", false, tr("Show full board details")) detailsCommand.Flags().StringVarP(&fqbn, "fqbn", "b", "", tr("Fully Qualified Board Name, e.g.: arduino:avr:uno")) detailsCommand.RegisterFlagCompletionFunc("fqbn", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - return arguments.GetInstalledBoards(toComplete), cobra.ShellCompDirectiveDefault + return arguments.GetInstalledBoards(), cobra.ShellCompDirectiveDefault }) detailsCommand.Flags().BoolVarP(&listProgrammers, "list-programmers", "", false, tr("Show list of available programmers")) // detailsCommand.MarkFlagRequired("fqbn") // enable once `board details ` is removed diff --git a/cli/burnbootloader/burnbootloader.go b/cli/burnbootloader/burnbootloader.go index 20d1b57404e..7a1ea0db27f 100644 --- a/cli/burnbootloader/burnbootloader.go +++ b/cli/burnbootloader/burnbootloader.go @@ -52,14 +52,14 @@ func NewCommand() *cobra.Command { burnBootloaderCommand.Flags().StringVarP(&fqbn, "fqbn", "b", "", tr("Fully Qualified Board Name, e.g.: arduino:avr:uno")) burnBootloaderCommand.RegisterFlagCompletionFunc("fqbn", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - return arguments.GetInstalledBoards(toComplete), cobra.ShellCompDirectiveDefault + return arguments.GetInstalledBoards(), cobra.ShellCompDirectiveDefault }) port.AddToCommand(burnBootloaderCommand) burnBootloaderCommand.Flags().BoolVarP(&verify, "verify", "t", false, tr("Verify uploaded binary after the upload.")) burnBootloaderCommand.Flags().BoolVarP(&verbose, "verbose", "v", false, tr("Turns on verbose mode.")) burnBootloaderCommand.Flags().StringVarP(&programmer, "programmer", "P", "", tr("Use the specified programmer to upload.")) burnBootloaderCommand.RegisterFlagCompletionFunc("programmer", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - return arguments.GetInstalledProgrammers(toComplete), cobra.ShellCompDirectiveDefault + return arguments.GetInstalledProgrammers(), cobra.ShellCompDirectiveDefault }) burnBootloaderCommand.Flags().BoolVar(&dryRun, "dry-run", false, tr("Do not perform the actual upload, just log out actions")) burnBootloaderCommand.Flags().MarkHidden("dry-run") diff --git a/cli/compile/compile.go b/cli/compile/compile.go index 74301da222d..ead85347530 100644 --- a/cli/compile/compile.go +++ b/cli/compile/compile.go @@ -83,7 +83,7 @@ func NewCommand() *cobra.Command { command.Flags().StringVarP(&fqbn, "fqbn", "b", "", tr("Fully Qualified Board Name, e.g.: arduino:avr:uno")) command.RegisterFlagCompletionFunc("fqbn", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - return arguments.GetInstalledBoards(toComplete), cobra.ShellCompDirectiveDefault + return arguments.GetInstalledBoards(), cobra.ShellCompDirectiveDefault }) command.Flags().BoolVar(&showProperties, "show-properties", false, tr("Show all build properties used instead of compiling.")) command.Flags().BoolVar(&preprocess, "preprocess", false, tr("Print preprocessed code to stdout instead of compiling.")) @@ -110,7 +110,7 @@ func NewCommand() *cobra.Command { command.Flags().BoolVar(&optimizeForDebug, "optimize-for-debug", false, tr("Optional, optimize compile output for debugging, rather than for release.")) command.Flags().StringVarP(&programmer, "programmer", "P", "", tr("Optional, use the specified programmer to upload.")) command.RegisterFlagCompletionFunc("programmer", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - return arguments.GetInstalledProgrammers(toComplete), cobra.ShellCompDirectiveDefault + return arguments.GetInstalledProgrammers(), cobra.ShellCompDirectiveDefault }) command.Flags().BoolVar(&compilationDatabaseOnly, "only-compilation-database", false, tr("Just produce the compilation database, without actually compiling.")) command.Flags().BoolVar(&clean, "clean", false, tr("Optional, cleanup the build folder and do not use any cached build.")) diff --git a/cli/config/add.go b/cli/config/add.go index dbdf74a47c2..4f7ddbeeedb 100644 --- a/cli/config/add.go +++ b/cli/config/add.go @@ -36,7 +36,7 @@ func initAddCommand() *cobra.Command { Args: cobra.MinimumNArgs(2), Run: runAddCommand, ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - return GetConfigurationKeys(toComplete), cobra.ShellCompDirectiveDefault + return GetConfigurationKeys(), cobra.ShellCompDirectiveDefault }, } return addCommand diff --git a/cli/config/config.go b/cli/config/config.go index 9e75f08e7e8..41a03c60028 100644 --- a/cli/config/config.go +++ b/cli/config/config.go @@ -46,7 +46,7 @@ func NewCommand() *cobra.Command { // GetConfigurationKeys is an helper function useful to autocomplete. // It returns a list of configuration keys which can be changed -func GetConfigurationKeys(toComplete string) []string { +func GetConfigurationKeys() []string { var res []string keys := configuration.Settings.AllKeys() for _, key := range keys { diff --git a/cli/config/remove.go b/cli/config/remove.go index 6317005e0d0..f7fa1e2bc4e 100644 --- a/cli/config/remove.go +++ b/cli/config/remove.go @@ -36,7 +36,7 @@ func initRemoveCommand() *cobra.Command { Args: cobra.MinimumNArgs(2), Run: runRemoveCommand, ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - return GetConfigurationKeys(toComplete), cobra.ShellCompDirectiveDefault + return GetConfigurationKeys(), cobra.ShellCompDirectiveDefault }, } return addCommand diff --git a/cli/core/download.go b/cli/core/download.go index 041ca7d9898..30b21110241 100644 --- a/cli/core/download.go +++ b/cli/core/download.go @@ -42,7 +42,7 @@ func initDownloadCommand() *cobra.Command { Args: cobra.MinimumNArgs(1), Run: runDownloadCommand, ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - return arguments.GetInstallableCores(toComplete), cobra.ShellCompDirectiveDefault + return arguments.GetInstallableCores(), cobra.ShellCompDirectiveDefault }, } return downloadCommand diff --git a/cli/core/install.go b/cli/core/install.go index 667e048c903..44475c93ef9 100644 --- a/cli/core/install.go +++ b/cli/core/install.go @@ -44,7 +44,7 @@ func initInstallCommand() *cobra.Command { Args: cobra.MinimumNArgs(1), Run: runInstallCommand, ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - return arguments.GetInstallableCores(toComplete), cobra.ShellCompDirectiveDefault + return arguments.GetInstallableCores(), cobra.ShellCompDirectiveDefault }, } AddPostInstallFlagsToCommand(installCommand) diff --git a/cli/core/uninstall.go b/cli/core/uninstall.go index 482f407cfb2..86ac1af5c9b 100644 --- a/cli/core/uninstall.go +++ b/cli/core/uninstall.go @@ -40,7 +40,7 @@ func initUninstallCommand() *cobra.Command { Args: cobra.MinimumNArgs(1), Run: runUninstallCommand, ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - return arguments.GetUninstallableCores(toComplete), cobra.ShellCompDirectiveDefault + return arguments.GetUninstallableCores(), cobra.ShellCompDirectiveDefault }, } } diff --git a/cli/debug/debug.go b/cli/debug/debug.go index 2242c43567c..0a2afd1c4cc 100644 --- a/cli/debug/debug.go +++ b/cli/debug/debug.go @@ -60,12 +60,12 @@ func NewCommand() *cobra.Command { debugCommand.Flags().StringVarP(&fqbn, "fqbn", "b", "", tr("Fully Qualified Board Name, e.g.: arduino:avr:uno")) debugCommand.RegisterFlagCompletionFunc("fqbn", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - return arguments.GetInstalledBoards(toComplete), cobra.ShellCompDirectiveDefault + return arguments.GetInstalledBoards(), cobra.ShellCompDirectiveDefault }) port.AddToCommand(debugCommand) debugCommand.Flags().StringVarP(&programmer, "programmer", "P", "", tr("Programmer to use for debugging")) debugCommand.RegisterFlagCompletionFunc("programmer", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - return arguments.GetInstalledProgrammers(toComplete), cobra.ShellCompDirectiveDefault + return arguments.GetInstalledProgrammers(), cobra.ShellCompDirectiveDefault }) debugCommand.Flags().StringVar(&interpreter, "interpreter", "console", tr("Debug interpreter e.g.: %s", "console, mi, mi1, mi2, mi3")) debugCommand.Flags().StringVarP(&importDir, "input-dir", "", "", tr("Directory containing binaries for debug.")) diff --git a/cli/lib/check_deps.go b/cli/lib/check_deps.go index 9a91b63aa8a..3e8d0ec57cf 100644 --- a/cli/lib/check_deps.go +++ b/cli/lib/check_deps.go @@ -41,7 +41,7 @@ func initDepsCommand() *cobra.Command { Args: cobra.ExactArgs(1), Run: runDepsCommand, ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - return arguments.GetUninstallableLibs(toComplete), cobra.ShellCompDirectiveDefault + return arguments.GetUninstallableLibs(), cobra.ShellCompDirectiveDefault }, } return depsCommand diff --git a/cli/lib/download.go b/cli/lib/download.go index 4e0f6f3957b..f76e6a77686 100644 --- a/cli/lib/download.go +++ b/cli/lib/download.go @@ -41,7 +41,7 @@ func initDownloadCommand() *cobra.Command { Args: cobra.MinimumNArgs(1), Run: runDownloadCommand, ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - return arguments.GetInstallableLibs(toComplete), cobra.ShellCompDirectiveDefault + return arguments.GetInstallableLibs(), cobra.ShellCompDirectiveDefault }, } return downloadCommand diff --git a/cli/lib/examples.go b/cli/lib/examples.go index 8f34e30fe60..c65f35cd892 100644 --- a/cli/lib/examples.go +++ b/cli/lib/examples.go @@ -43,12 +43,12 @@ func initExamplesCommand() *cobra.Command { Args: cobra.MaximumNArgs(1), Run: runExamplesCommand, ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - return arguments.GetUninstallableLibs(toComplete), cobra.ShellCompDirectiveDefault + return arguments.GetUninstallableLibs(), cobra.ShellCompDirectiveDefault }, } examplesCommand.Flags().StringVarP(&examplesFlags.fqbn, "fqbn", "b", "", tr("Show libraries for the specified board FQBN.")) examplesCommand.RegisterFlagCompletionFunc("fqbn", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - return arguments.GetInstalledBoards(toComplete), cobra.ShellCompDirectiveDefault + return arguments.GetInstalledBoards(), cobra.ShellCompDirectiveDefault }) return examplesCommand } diff --git a/cli/lib/install.go b/cli/lib/install.go index f7a3e1b6b9e..5f1865bed42 100644 --- a/cli/lib/install.go +++ b/cli/lib/install.go @@ -48,7 +48,7 @@ func initInstallCommand() *cobra.Command { Args: cobra.MinimumNArgs(1), Run: runInstallCommand, ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - return arguments.GetInstallableLibs(toComplete), cobra.ShellCompDirectiveDefault + return arguments.GetInstallableLibs(), cobra.ShellCompDirectiveDefault }, } installCommand.Flags().BoolVar(&installFlags.noDeps, "no-deps", false, tr("Do not install dependencies.")) diff --git a/cli/lib/uninstall.go b/cli/lib/uninstall.go index deaa6688ac4..6a99a8f2d4c 100644 --- a/cli/lib/uninstall.go +++ b/cli/lib/uninstall.go @@ -40,7 +40,7 @@ func initUninstallCommand() *cobra.Command { Args: cobra.MinimumNArgs(1), Run: runUninstallCommand, ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - return arguments.GetUninstallableLibs(toComplete), cobra.ShellCompDirectiveDefault + return arguments.GetUninstallableLibs(), cobra.ShellCompDirectiveDefault }, } return uninstallCommand diff --git a/cli/upload/upload.go b/cli/upload/upload.go index 77dc11a99cd..6fe40ab15f3 100644 --- a/cli/upload/upload.go +++ b/cli/upload/upload.go @@ -56,7 +56,7 @@ func NewCommand() *cobra.Command { uploadCommand.Flags().StringVarP(&fqbn, "fqbn", "b", "", tr("Fully Qualified Board Name, e.g.: arduino:avr:uno")) uploadCommand.RegisterFlagCompletionFunc("fqbn", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - return arguments.GetInstalledBoards(toComplete), cobra.ShellCompDirectiveDefault + return arguments.GetInstalledBoards(), cobra.ShellCompDirectiveDefault }) port.AddToCommand(uploadCommand) uploadCommand.Flags().StringVarP(&importDir, "input-dir", "", "", tr("Directory containing binaries to upload.")) @@ -65,7 +65,7 @@ func NewCommand() *cobra.Command { uploadCommand.Flags().BoolVarP(&verbose, "verbose", "v", false, tr("Optional, turns on verbose mode.")) uploadCommand.Flags().StringVarP(&programmer, "programmer", "P", "", tr("Optional, use the specified programmer to upload.")) uploadCommand.RegisterFlagCompletionFunc("programmer", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - return arguments.GetInstalledProgrammers(toComplete), cobra.ShellCompDirectiveDefault + return arguments.GetInstalledProgrammers(), cobra.ShellCompDirectiveDefault }) uploadCommand.Flags().BoolVar(&dryRun, "dry-run", false, tr("Do not perform the actual upload, just log out actions")) uploadCommand.Flags().MarkHidden("dry-run") From 2a953a9708321ea5ba53a76de38670cf377ed187 Mon Sep 17 00:00:00 2001 From: Umberto Baldi Date: Wed, 13 Oct 2021 17:39:49 +0200 Subject: [PATCH 18/22] fixes after rebase --- i18n/data/en.po | 290 ++++++++++++++++++++++++++++++------------------ 1 file changed, 185 insertions(+), 105 deletions(-) diff --git a/i18n/data/en.po b/i18n/data/en.po index 91c08d419e1..41742f18e37 100644 --- a/i18n/data/en.po +++ b/i18n/data/en.po @@ -66,11 +66,11 @@ msgstr "%s must be installed." msgid "%s pattern is missing" msgstr "%s pattern is missing" -#: commands/instances.go:839 +#: commands/instances.go:850 msgid "%s uninstalled" msgstr "%s uninstalled" -#: commands/errors.go:595 +#: commands/errors.go:658 msgid "'%s' has an invalid signature" msgstr "'%s' has an invalid signature" @@ -95,7 +95,7 @@ msgstr "--git-url and --zip-path flags allow installing untrusted files, use it msgid "A new release of Arduino CLI is available:" msgstr "A new release of Arduino CLI is available:" -#: commands/errors.go:181 +#: commands/errors.go:207 msgid "A programmer is required to upload" msgstr "A programmer is required to upload" @@ -127,7 +127,7 @@ msgstr "Aliases:" msgid "All the cores are already at the latest version" msgstr "All the cores are already at the latest version" -#: commands/instances.go:708 +#: commands/instances.go:719 #: commands/lib/install.go:96 msgid "Already installed %s" msgstr "Already installed %s" @@ -153,11 +153,11 @@ msgstr "Archiving built core (caching) in: {0}" msgid "Arduino CLI sketch commands." msgstr "Arduino CLI sketch commands." -#: cli/cli.go:71 +#: cli/cli.go:72 msgid "Arduino CLI." msgstr "Arduino CLI." -#: cli/cli.go:72 +#: cli/cli.go:73 msgid "Arduino Command Line Interface (arduino-cli)." msgstr "Arduino Command Line Interface (arduino-cli)." @@ -243,7 +243,7 @@ msgstr "Bootloader file specified but missing: {0}" msgid "Builds of 'core.a' are saved into this path to be cached and reused." msgstr "Builds of 'core.a' are saved into this path to be cached and reused." -#: commands/instances.go:521 +#: commands/instances.go:532 msgid "Can't create data directory %s" msgstr "Can't create data directory %s" @@ -255,12 +255,12 @@ msgstr "Can't download library" #: commands/core/install.go:126 #: commands/core/uninstall.go:52 -#: commands/instances.go:747 -#: commands/instances.go:759 +#: commands/instances.go:758 +#: commands/instances.go:770 msgid "Can't find dependencies for platform %s" msgstr "Can't find dependencies for platform %s" -#: commands/errors.go:332 +#: commands/errors.go:377 msgid "Can't open sketch" msgstr "Can't open sketch" @@ -294,11 +294,11 @@ msgstr "Cannot create config file directory: %v" msgid "Cannot create config file: %v" msgstr "Cannot create config file: %v" -#: commands/errors.go:558 +#: commands/errors.go:621 msgid "Cannot create temp dir" msgstr "Cannot create temp dir" -#: commands/errors.go:576 +#: commands/errors.go:639 msgid "Cannot create temp file" msgstr "Cannot create temp file" @@ -365,7 +365,7 @@ msgstr "Checksum:" msgid "Clean caches." msgstr "Clean caches." -#: cli/cli.go:120 +#: cli/cli.go:122 msgid "Comma-separated list of additional URLs for the Boards Manager." msgstr "Comma-separated list of additional URLs for the Boards Manager." @@ -407,11 +407,15 @@ msgstr "Config file already exists, use --overwrite to discard the existing one. msgid "Config file written to: %s" msgstr "Config file written to: %s" +#: cli/monitor/monitor.go:61 +msgid "Configuration of the port." +msgstr "Configuration of the port." + #: cli/debug/debug.go:159 msgid "Configuration options for %s" msgstr "Configuration options for %s" -#: commands/instances.go:846 +#: commands/instances.go:857 msgid "Configuring platform" msgstr "Configuring platform" @@ -423,6 +427,10 @@ msgstr "Configuring platform." msgid "Connected" msgstr "Connected" +#: cli/monitor/monitor.go:174 +msgid "Connected to %s! Press CTRL-C to exit." +msgstr "Connected to %s! Press CTRL-C to exit." + #: cli/board/list.go:87 #: cli/board/list.go:125 msgid "Core" @@ -436,7 +444,7 @@ msgstr "Core name" msgid "Could not connect via HTTP" msgstr "Could not connect via HTTP" -#: commands/instances.go:362 +#: commands/instances.go:373 msgid "Could not create index directory" msgstr "Could not create index directory" @@ -496,6 +504,10 @@ msgstr "Debugging not supported for board %s" msgid "Debugging supported:" msgstr "Debugging supported:" +#: cli/monitor/monitor.go:192 +msgid "Default" +msgstr "Default" + #: cli/cache/clean.go:31 msgid "Delete Boards/Library Manager download cache." msgstr "Delete Boards/Library Manager download cache." @@ -566,8 +578,8 @@ msgstr "Do not perform the actual upload, just log out actions" msgid "Do not terminate daemon process if the parent process dies" msgstr "Do not terminate daemon process if the parent process dies" -#: commands/instances.go:697 -#: commands/instances.go:756 +#: commands/instances.go:708 +#: commands/instances.go:767 #: commands/lib/download.go:57 msgid "Downloading %s" msgstr "Downloading %s" @@ -658,43 +670,43 @@ msgstr "Error detecting boards: %v" msgid "Error downloading %[1]s: %[2]v" msgstr "Error downloading %[1]s: %[2]v" -#: commands/instances.go:467 -#: commands/instances.go:471 -#: commands/instances.go:476 +#: commands/instances.go:478 +#: commands/instances.go:482 +#: commands/instances.go:487 msgid "Error downloading index '%s'" msgstr "Error downloading index '%s'" -#: commands/instances.go:500 -#: commands/instances.go:506 +#: commands/instances.go:511 +#: commands/instances.go:517 msgid "Error downloading index signature '%s'" msgstr "Error downloading index signature '%s'" -#: commands/instances.go:699 -#: commands/instances.go:701 +#: commands/instances.go:710 +#: commands/instances.go:712 msgid "Error downloading library" msgstr "Error downloading library" -#: commands/instances.go:376 -#: commands/instances.go:379 +#: commands/instances.go:387 +#: commands/instances.go:390 msgid "Error downloading library_index.json.gz" msgstr "Error downloading library_index.json.gz" -#: commands/instances.go:386 -#: commands/instances.go:389 +#: commands/instances.go:397 +#: commands/instances.go:400 msgid "Error downloading library_index.json.sig" msgstr "Error downloading library_index.json.sig" #: commands/core/download.go:70 #: commands/core/download.go:74 -#: commands/instances.go:782 -#: commands/instances.go:784 +#: commands/instances.go:793 +#: commands/instances.go:795 msgid "Error downloading platform %s" msgstr "Error downloading platform %s" #: commands/core/download.go:83 #: commands/core/download.go:88 -#: commands/instances.go:775 -#: commands/instances.go:776 +#: commands/instances.go:786 +#: commands/instances.go:787 msgid "Error downloading tool %s" msgstr "Error downloading tool %s" @@ -737,7 +749,7 @@ msgstr "Error during uninstall: %v" msgid "Error during upgrade: %v" msgstr "Error during upgrade: %v" -#: commands/instances.go:395 +#: commands/instances.go:406 msgid "Error extracting library_index.json.gz" msgstr "Error extracting library_index.json.gz" @@ -778,6 +790,10 @@ msgstr "Error getting information for library %s" msgid "Error getting libraries info: %v" msgstr "Error getting libraries info: %v" +#: cli/monitor/monitor.go:87 +msgid "Error getting port settings details: %s" +msgstr "Error getting port settings details: %s" + #: legacy/builder/types/context.go:239 msgid "Error in FQBN: %s" msgstr "Error in FQBN: %s" @@ -801,11 +817,11 @@ msgstr "Error installing Git Library: %v" msgid "Error installing Zip Library: %v" msgstr "Error installing Zip Library: %v" -#: commands/instances.go:803 +#: commands/instances.go:814 msgid "Error installing platform %s" msgstr "Error installing platform %s" -#: commands/instances.go:793 +#: commands/instances.go:804 msgid "Error installing tool %s" msgstr "Error installing tool %s" @@ -854,7 +870,7 @@ msgstr "Error retrieving core list: %v" msgid "Error retrieving outdated cores and libraries: %v" msgstr "Error retrieving outdated cores and libraries: %v" -#: commands/instances.go:819 +#: commands/instances.go:830 msgid "Error rolling-back changes" msgstr "Error rolling-back changes" @@ -862,11 +878,11 @@ msgstr "Error rolling-back changes" msgid "Error rolling-back changes: %s" msgstr "Error rolling-back changes: %s" -#: commands/instances.go:525 +#: commands/instances.go:536 msgid "Error saving downloaded index %s" msgstr "Error saving downloaded index %s" -#: commands/instances.go:529 +#: commands/instances.go:540 msgid "Error saving downloaded index signature" msgstr "Error saving downloaded index signature" @@ -901,7 +917,7 @@ msgid "Error uninstalling platform %s" msgstr "Error uninstalling platform %s" #: commands/core/uninstall.go:96 -#: commands/instances.go:835 +#: commands/instances.go:846 msgid "Error uninstalling tool %s" msgstr "Error uninstalling tool %s" @@ -931,7 +947,7 @@ msgid "Error upgrading libraries: %v" msgstr "Error upgrading libraries: %v" #: commands/core/install.go:143 -#: commands/instances.go:814 +#: commands/instances.go:825 msgid "Error upgrading platform: %s" msgstr "Error upgrading platform: %s" @@ -939,8 +955,8 @@ msgstr "Error upgrading platform: %s" msgid "Error upgrading: %v" msgstr "Error upgrading: %v" -#: commands/instances.go:400 -#: commands/instances.go:510 +#: commands/instances.go:411 +#: commands/instances.go:521 msgid "Error verifying signature" msgstr "Error verifying signature" @@ -957,11 +973,11 @@ msgstr "Error while determining sketch size: %s" msgid "Error writing compilation database: %s" msgstr "Error writing compilation database: %s" -#: commands/instances.go:409 +#: commands/instances.go:420 msgid "Error writing library_index.json" msgstr "Error writing library_index.json" -#: commands/instances.go:412 +#: commands/instances.go:423 msgid "Error writing library_index.json.sig" msgstr "Error writing library_index.json.sig" @@ -1075,6 +1091,7 @@ msgstr "Force skip of post-install scripts (if the CLI is running interactively) #: cli/burnbootloader/burnbootloader.go:53 #: cli/compile/compile.go:84 #: cli/debug/debug.go:61 +#: cli/monitor/monitor.go:63 #: cli/upload/upload.go:57 msgid "Fully Qualified Board Name, e.g.: arduino:avr:uno" msgstr "Fully Qualified Board Name, e.g.: arduino:avr:uno" @@ -1122,6 +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/outdated/outdated.go:62 msgid "ID" msgstr "ID" @@ -1156,7 +1174,7 @@ msgstr "Includes %s directory in the archive." msgid "Installed" msgstr "Installed" -#: commands/instances.go:722 +#: commands/instances.go:733 #: commands/lib/install.go:112 msgid "Installed %s" msgstr "Installed %s" @@ -1169,7 +1187,7 @@ msgid "Installed version" msgstr "Installed version" #: commands/bundled_tools.go:48 -#: commands/instances.go:705 +#: commands/instances.go:716 #: commands/lib/install.go:92 msgid "Installing %s" msgstr "Installing %s" @@ -1192,11 +1210,11 @@ msgstr "Installs one or more specified libraries into the system." msgid "Internal error in cache" msgstr "Internal error in cache" -#: commands/errors.go:218 +#: commands/errors.go:263 msgid "Invalid '%[1]s' property: %[2]s" msgstr "Invalid '%[1]s' property: %[2]s" -#: cli/cli.go:261 +#: cli/cli.go:263 msgid "Invalid Call : should show Help, but it is available only in TEXT mode." msgstr "Invalid Call : should show Help, but it is available only in TEXT mode." @@ -1212,7 +1230,7 @@ msgstr "Invalid FQBN" msgid "Invalid URL" msgstr "Invalid URL" -#: commands/instances.go:192 +#: commands/instances.go:193 msgid "Invalid additional URL: %v" msgstr "Invalid additional URL: %v" @@ -1253,16 +1271,16 @@ msgstr "Invalid library" msgid "Invalid network.proxy '%[1]s': %[2]s" msgstr "Invalid network.proxy '%[1]s': %[2]s" -#: cli/cli.go:222 +#: cli/cli.go:224 msgid "Invalid option for --log-level: %s" msgstr "Invalid option for --log-level: %s" -#: cli/cli.go:239 +#: cli/cli.go:241 msgid "Invalid output format: %s" msgstr "Invalid output format: %s" -#: commands/instances.go:443 -#: commands/instances.go:517 +#: commands/instances.go:454 +#: commands/instances.go:528 msgid "Invalid package index in %s" msgstr "Invalid package index in %s" @@ -1274,6 +1292,10 @@ msgstr "Invalid parameter %s: version not allowed" msgid "Invalid pid value: '%s'" msgstr "Invalid pid value: '%s'" +#: commands/monitor/monitor.go:122 +msgid "Invalid recipe in platform.txt" +msgstr "Invalid recipe in platform.txt" + #: legacy/builder/phases/sizer.go:162 msgid "Invalid size regexp: %s" msgstr "Invalid size regexp: %s" @@ -1314,7 +1336,7 @@ msgstr "Latest" msgid "Library %s is not installed" msgstr "Library %s is not installed" -#: commands/errors.go:266 +#: commands/errors.go:311 msgid "Library '%s' not found" msgstr "Library '%s' not found" @@ -1322,7 +1344,7 @@ msgstr "Library '%s' not found" msgid "Library can't use both '%[1]s' and '%[2]s' folders. Double check {0}" msgstr "Library can't use both '%[1]s' and '%[2]s' folders. Double check {0}" -#: commands/errors.go:369 +#: commands/errors.go:414 msgid "Library install failed" msgstr "Library install failed" @@ -1392,13 +1414,13 @@ msgstr "Lists all connected boards." msgid "Lists cores and libraries that can be upgraded" msgstr "Lists cores and libraries that can be upgraded" -#: commands/instances.go:206 -#: commands/instances.go:217 -#: commands/instances.go:318 +#: commands/instances.go:207 +#: commands/instances.go:218 +#: commands/instances.go:329 msgid "Loading index file: %v" msgstr "Loading index file: %v" -#: commands/instances.go:327 +#: commands/instances.go:338 msgid "Loading libraries: %v" msgstr "Loading libraries: %v" @@ -1422,7 +1444,7 @@ msgstr "Maintainer: %s" msgid "Max time to wait for port discovery, e.g.: 30s, 1m" msgstr "Max time to wait for port discovery, e.g.: 30s, 1m" -#: cli/cli.go:106 +#: cli/cli.go:108 msgid "Messages with this level and above will be logged. Valid levels are: %s" msgstr "Messages with this level and above will be logged. Valid levels are: %s" @@ -1434,11 +1456,15 @@ msgstr "Missing '{0}' from library in {1}" msgid "Missing FQBN (Fully Qualified Board Name)" msgstr "Missing FQBN (Fully Qualified Board Name)" +#: commands/errors.go:169 +msgid "Missing port" +msgstr "Missing port" + #: commands/errors.go:157 msgid "Missing port protocol" msgstr "Missing port protocol" -#: commands/errors.go:169 +#: commands/errors.go:195 msgid "Missing programmer" msgstr "Missing programmer" @@ -1446,10 +1472,18 @@ msgstr "Missing programmer" msgid "Missing size regexp" msgstr "Missing size regexp" -#: commands/errors.go:318 +#: commands/errors.go:363 msgid "Missing sketch path" msgstr "Missing sketch path" +#: commands/errors.go:244 +msgid "Monitor '%s' not found" +msgstr "Monitor '%s' not found" + +#: cli/monitor/monitor.go:140 +msgid "Monitor port settings:" +msgstr "Monitor port settings:" + #: legacy/builder/print_used_and_not_used_libraries.go:50 msgid "Multiple libraries were found for \"{0}\"" msgstr "Multiple libraries were found for \"{0}\"" @@ -1501,6 +1535,10 @@ msgstr "No libraries matching your search.\n" "Did you mean...\n" "" +#: commands/errors.go:183 +msgid "No monitor available for the port protocol %s" +msgstr "No monitor available for the port protocol %s" + #: cli/core/search.go:124 msgid "No platforms matching your search." msgstr "No platforms matching your search." @@ -1517,7 +1555,7 @@ msgstr "No updates available." msgid "No upload port found, using %s as fallback" msgstr "No upload port found, using %s as fallback" -#: commands/errors.go:285 +#: commands/errors.go:330 msgid "No valid dependencies solution found" msgstr "No valid dependencies solution found" @@ -1547,6 +1585,11 @@ msgstr "OS:" msgid "Official Arduino board:" msgstr "Official Arduino board:" +#: cli/monitor/monitor.go:52 +#: cli/monitor/monitor.go:53 +msgid "Open a communication port with a board." +msgstr "Open a communication port with a board." + #: cli/board/details.go:181 msgid "Option:" msgstr "Option:" @@ -1624,7 +1667,7 @@ msgstr "Package website:" msgid "Paragraph: %s" msgstr "Paragraph: %s" -#: cli/cli.go:110 +#: cli/cli.go:112 msgid "Path to the file where logs will be written." msgstr "Path to the file where logs will be written." @@ -1648,11 +1691,11 @@ msgstr "Platform %s installed" msgid "Platform %s uninstalled" msgstr "Platform %s uninstalled" -#: commands/errors.go:303 +#: commands/errors.go:348 msgid "Platform '%s' is already at the latest version" msgstr "Platform '%s' is already at the latest version" -#: commands/errors.go:247 +#: commands/errors.go:292 msgid "Platform '%s' not found" msgstr "Platform '%s' not found" @@ -1693,6 +1736,15 @@ msgstr "Platform size (bytes):" msgid "Port" msgstr "Port" +#: cli/monitor/monitor.go:161 +#: cli/monitor/monitor.go:168 +msgid "Port closed:" +msgstr "Port closed:" + +#: commands/errors.go:508 +msgid "Port monitor error" +msgstr "Port monitor error" + #: legacy/builder/phases/libraries_builder.go:101 #: legacy/builder/phases/libraries_builder.go:109 msgid "Precompiled library in \"{0}\" not found" @@ -1706,7 +1758,7 @@ msgstr "Print details about a board." msgid "Print preprocessed code to stdout instead of compiling." msgstr "Print preprocessed code to stdout instead of compiling." -#: cli/cli.go:105 +#: cli/cli.go:107 msgid "Print the logs on the standard output." msgstr "Print the logs on the standard output." @@ -1718,7 +1770,7 @@ msgstr "Prints the current configuration" msgid "Prints the current configuration." msgstr "Prints the current configuration." -#: commands/errors.go:199 +#: commands/errors.go:225 msgid "Programmer '%s' not found" msgstr "Programmer '%s' not found" @@ -1738,7 +1790,7 @@ msgstr "Programmers:" msgid "Progress {0}" msgstr "Progress {0}" -#: commands/errors.go:232 +#: commands/errors.go:277 msgid "Property '%s' is undefined" msgstr "Property '%s' is undefined" @@ -1755,7 +1807,7 @@ msgstr "Provides includes: %s" msgid "Removes one or more values from a setting." msgstr "Removes one or more values from a setting." -#: commands/instances.go:715 +#: commands/instances.go:726 #: commands/lib/install.go:105 msgid "Replacing %[1]s with %[2]s" msgstr "Replacing %[1]s with %[2]s" @@ -1768,6 +1820,10 @@ msgstr "Required tool:" msgid "Run as a daemon on port: %s" msgstr "Run as a daemon on port: %s" +#: cli/monitor/monitor.go:62 +msgid "Run in silent mode, show only monitor input and output." +msgstr "Run in silent mode, show only monitor input and output." + #: cli/daemon/daemon.go:51 msgid "Running as a daemon the initialization of cores and libraries is done only once." msgstr "Running as a daemon the initialization of cores and libraries is done only once." @@ -1822,6 +1878,10 @@ 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 +msgid "Setting" +msgstr "Setting" + #: cli/config/delete.go:60 #: cli/config/validate.go:45 msgid "Settings key doesn't exist" @@ -1835,6 +1895,10 @@ msgstr "Show all available core versions." msgid "Show all build properties used instead of compiling." msgstr "Show all build properties used instead of compiling." +#: cli/monitor/monitor.go:60 +msgid "Show all the settings of the communication port." +msgstr "Show all the settings of the communication port." + #: cli/board/listall.go:45 #: cli/board/search.go:46 msgid "Show also boards marked as 'hidden' in the platform" @@ -1952,7 +2016,7 @@ msgstr "Skipping compile of: {0}" msgid "Skipping dependencies detection for precompiled library {0}" msgstr "Skipping dependencies detection for precompiled library {0}" -#: commands/instances.go:852 +#: commands/instances.go:863 msgid "Skipping platform configuration" msgstr "Skipping platform configuration" @@ -1980,7 +2044,7 @@ msgstr "The connected devices search timeout, raise it if your board doesn't sho msgid "The connected devices search timeout, raise it if your board doesn't show up e.g.: 10s" msgstr "The connected devices search timeout, raise it if your board doesn't show up e.g.: 10s" -#: cli/cli.go:119 +#: cli/cli.go:121 msgid "The custom config file (if not specified the default will be used)." msgstr "The custom config file (if not specified the default will be used)." @@ -2000,8 +2064,8 @@ msgid "The key '%[1]v' is not a list of items, can't remove from it.\n" msgstr "The key '%[1]v' is not a list of items, can't remove from it.\n" "Maybe use '%[2]s'?" -#: cli/cli.go:111 -#: cli/cli.go:115 +#: cli/cli.go:113 +#: cli/cli.go:117 msgid "The output format for the logs, can be: %s" msgstr "The output format for the logs, can be: %s" @@ -2021,7 +2085,7 @@ msgstr "This commands shows a list of installed cores and/or libraries\n" #: commands/bundled_tools.go:43 #: commands/core/install.go:79 -#: commands/instances.go:766 +#: commands/instances.go:777 msgid "Tool %s already installed" msgstr "Tool %s already installed" @@ -2083,7 +2147,7 @@ msgstr "Unable to get Local App Data Folder: %v" msgid "Unable to get user home dir: %v" msgstr "Unable to get user home dir: %v" -#: cli/cli.go:208 +#: cli/cli.go:210 msgid "Unable to open file for logging: %s" msgstr "Unable to open file for logging: %s" @@ -2096,7 +2160,7 @@ msgstr "Uninstalling %s" msgid "Uninstalling %s, tool is no more required" msgstr "Uninstalling %s, tool is no more required" -#: commands/instances.go:831 +#: commands/instances.go:842 msgid "Uninstalling %s: tool is no more required" msgstr "Uninstalling %s: tool is no more required" @@ -2142,21 +2206,21 @@ msgstr "Updates the libraries index to the latest version." msgid "Updates the libraries index." msgstr "Updates the libraries index." -#: commands/instances.go:448 -#: commands/instances.go:474 -#: commands/instances.go:504 +#: commands/instances.go:459 +#: commands/instances.go:485 +#: commands/instances.go:515 msgid "Updating index: %s" msgstr "Updating index: %s" -#: commands/instances.go:375 +#: commands/instances.go:386 msgid "Updating index: library_index.json.gz" msgstr "Updating index: library_index.json.gz" -#: commands/instances.go:385 +#: commands/instances.go:396 msgid "Updating index: library_index.json.sig" msgstr "Updating index: library_index.json.sig" -#: commands/instances.go:788 +#: commands/instances.go:799 msgid "Updating platform %s" msgstr "Updating platform %s" @@ -2289,6 +2353,10 @@ msgstr "VERSION" msgid "VERSION_NUMBER" msgstr "VERSION_NUMBER" +#: cli/monitor/monitor.go:192 +msgid "Values" +msgstr "Values" + #: cli/burnbootloader/burnbootloader.go:58 #: cli/compile/compile.go:104 #: cli/upload/upload.go:64 @@ -2307,7 +2375,7 @@ msgstr "Versions: %s" msgid "WARNING cannot configure platform: %s" msgstr "WARNING cannot configure platform: %s" -#: commands/instances.go:848 +#: commands/instances.go:859 msgid "WARNING: cannot run post install: %s" msgstr "WARNING: cannot run post install: %s" @@ -2406,7 +2474,7 @@ msgstr "can't find latest release of %s" msgid "can't find main Sketch file in %s" msgstr "can't find main Sketch file in %s" -#: arduino/cores/packagemanager/loader.go:768 +#: arduino/cores/packagemanager/loader.go:791 msgid "can't find pattern for discovery with id %s" msgstr "can't find pattern for discovery with id %s" @@ -2436,11 +2504,11 @@ msgstr "checking local archive integrity" msgid "cleaning build path" msgstr "cleaning build path" -#: cli/cli.go:73 +#: cli/cli.go:74 msgid "command" msgstr "command" -#: arduino/monitor/monitor.go:157 +#: arduino/monitor/monitor.go:149 msgid "command '%[1]s' failed: %[2]s" msgstr "command '%[1]s' failed: %[2]s" @@ -2453,7 +2521,7 @@ msgstr "command '%[1]s' failed: %[2]s" msgid "command failed: %s" msgstr "command failed: %s" -#: arduino/monitor/monitor.go:154 +#: arduino/monitor/monitor.go:146 msgid "communication out of sync, expected '%[1]s', received '%[2]s'" msgstr "communication out of sync, expected '%[1]s', received '%[2]s'" @@ -2489,7 +2557,7 @@ msgstr "computing hash: %s" msgid "could not find a valid build artifact" msgstr "could not find a valid build artifact" -#: arduino/cores/packagemanager/loader.go:705 +#: arduino/cores/packagemanager/loader.go:728 msgid "creating discovery: %s" msgstr "creating discovery: %s" @@ -2530,11 +2598,11 @@ msgstr "directory doesn't exist: %s" msgid "discovery %[1]s process not started: %[2]w" msgstr "discovery %[1]s process not started: %[2]w" -#: arduino/cores/packagemanager/loader.go:696 +#: arduino/cores/packagemanager/loader.go:719 msgid "discovery not found: %s" msgstr "discovery not found: %s" -#: arduino/cores/packagemanager/loader.go:700 +#: arduino/cores/packagemanager/loader.go:723 msgid "discovery not installed: %s" msgstr "discovery not installed: %s" @@ -2616,7 +2684,7 @@ msgstr "find abs path: %s" msgid "first message must contain monitor configuration, not data" msgstr "first message must contain monitor configuration, not data" -#: cli/cli.go:73 +#: cli/cli.go:74 msgid "flags" msgstr "flags" @@ -2671,7 +2739,7 @@ msgstr "getting build properties for board %[1]s: %[2]s" msgid "getting discovery dependencies for platform %[1]s: %[2]s" msgstr "getting discovery dependencies for platform %[1]s: %[2]s" -#: arduino/cores/packagemanager/loader.go:649 +#: arduino/cores/packagemanager/loader.go:672 msgid "getting parent dir of %[1]s: %[2]s" msgstr "getting parent dir of %[1]s: %[2]s" @@ -2788,6 +2856,18 @@ msgstr "invalid path writing inventory file: %[1]s error: %[2]w" msgid "invalid platform archive size: %s" msgstr "invalid platform archive size: %s" +#: arduino/cores/packagemanager/loader.go:369 +msgid "invalid pluggable monitor reference: %s" +msgstr "invalid pluggable monitor reference: %s" + +#: cli/monitor/monitor.go:123 +msgid "invalid port configuration value for %s: %s" +msgstr "invalid port configuration value for %s: %s" + +#: cli/monitor/monitor.go:132 +msgid "invalid port configuration: %s" +msgstr "invalid port configuration: %s" + #: commands/upload/upload.go:483 msgid "invalid recipe '%[1]s': %[2]s" msgstr "invalid recipe '%[1]s': %[2]s" @@ -2839,11 +2919,11 @@ msgstr "listing serial ports" msgid "loading %[1]s: %[2]s" msgstr "loading %[1]s: %[2]s" -#: arduino/cores/packagemanager/loader.go:356 +#: arduino/cores/packagemanager/loader.go:357 msgid "loading boards: %s" msgstr "loading boards: %s" -#: arduino/cores/packagemanager/loader.go:604 +#: arduino/cores/packagemanager/loader.go:627 msgid "loading bundled tools from %[1]s: %[2]s" msgstr "loading bundled tools from %[1]s: %[2]s" @@ -2870,7 +2950,7 @@ msgstr "loading platform release %[1]s: %[2]s" msgid "loading platform.txt: %v" msgstr "loading platform.txt: %v" -#: arduino/cores/packagemanager/loader.go:571 +#: arduino/cores/packagemanager/loader.go:594 msgid "loading tool release in %[1]s: %[2]s" msgstr "loading tool release in %[1]s: %[2]s" @@ -2923,7 +3003,7 @@ msgstr "no compatible version of %s tools found for the current os" msgid "no executable specified" msgstr "no executable specified" -#: commands/daemon/daemon.go:96 +#: commands/daemon/daemon.go:100 msgid "no instance specified" msgstr "no instance specified" @@ -3014,7 +3094,7 @@ msgstr "platform %s is not installed" #: arduino/cores/packagemanager/install_uninstall.go:65 #: arduino/cores/packagemanager/install_uninstall.go:108 -#: arduino/cores/packagemanager/loader.go:433 +#: arduino/cores/packagemanager/loader.go:456 #: commands/compile/compile.go:127 msgid "platform not installed" msgstr "platform not installed" @@ -3031,11 +3111,11 @@ msgstr "pluggable discovery already added: %s" msgid "port" msgstr "port" -#: cli/arguments/port.go:128 +#: cli/arguments/port.go:143 msgid "port not found: %[1]s %[2]s" msgstr "port not found: %[1]s %[2]s" -#: arduino/monitor/monitor.go:246 +#: arduino/monitor/monitor.go:238 msgid "protocol version not supported: requested %[1]d, got %[2]d" msgstr "protocol version not supported: requested %[1]d, got %[2]d" @@ -3051,7 +3131,7 @@ msgstr "quitting discovery %[1]s: %[2]w" msgid "reading %[1]s directory: %[2]s" msgstr "reading %[1]s directory: %[2]s" -#: arduino/cores/packagemanager/loader.go:654 +#: arduino/cores/packagemanager/loader.go:677 msgid "reading %[1]s: %[2]s" msgstr "reading %[1]s: %[2]s" @@ -3061,7 +3141,7 @@ msgid "reading dir %[1]s: %[2]s" msgstr "reading dir %[1]s: %[2]s" #: arduino/cores/packagemanager/loader.go:162 -#: arduino/cores/packagemanager/loader.go:562 +#: arduino/cores/packagemanager/loader.go:585 msgid "reading directory %[1]s: %[2]s" msgstr "reading directory %[1]s: %[2]s" @@ -3152,7 +3232,7 @@ msgstr "retrieving Arduino public keys: %s" msgid "scanning examples: %s" msgstr "scanning examples: %s" -#: arduino/cores/packagemanager/loader.go:640 +#: arduino/cores/packagemanager/loader.go:663 msgid "searching for builtin_tools_versions.txt in %[1]s: %[2]s" msgstr "searching for builtin_tools_versions.txt in %[1]s: %[2]s" @@ -3173,7 +3253,7 @@ msgstr "sketch path is not valid" msgid "sketchPath" msgstr "sketchPath" -#: arduino/cores/packagemanager/loader.go:496 +#: arduino/cores/packagemanager/loader.go:519 msgid "skipping loading of boards %s: malformed custom board options" msgstr "skipping loading of boards %s: malformed custom board options" @@ -3225,7 +3305,7 @@ msgstr "the platform has no releases" msgid "the server responded with status %s" msgstr "the server responded with status %s" -#: arduino/monitor/monitor.go:147 +#: arduino/monitor/monitor.go:139 msgid "timeout waiting for message" msgstr "timeout waiting for message" From 7235896ff459ded79ee294fec76083e48f60329b Mon Sep 17 00:00:00 2001 From: Umberto Baldi Date: Wed, 13 Oct 2021 17:47:14 +0200 Subject: [PATCH 19/22] update docs --- docs/command-line-completion.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/command-line-completion.md b/docs/command-line-completion.md index 5d1433ccc89..50c4aab7ac0 100644 --- a/docs/command-line-completion.md +++ b/docs/command-line-completion.md @@ -1,5 +1,5 @@ -`arduino-cli` supports command-line completion (also known as _tab completion_) for basic commands. Currently only -`bash`, `zsh`, `fish`, and `powershell` shells are supported +`arduino-cli` supports command-line completion (also known as _tab completion_) for basic commands. Currently `bash`, +`zsh`, `fish`, and `powershell` shells are supported ### Before you start @@ -62,11 +62,11 @@ For more information on tab-completion on PowerShell, please, refer to #### Disabling command and flag descriptions -By default fish and zsh completion have command and flag description enabled by default. If you want to disable this -behaviour you can simply pass the `--no-descriptions` flag when calling `completion` command and the generated file will -not have descriptions +By default fish, zsh and bash completion have command and flag description enabled by default. If you want to disable +this behaviour you can simply pass the `--no-descriptions` flag when calling `completion` command and the generated file +will not have descriptions -_N.B._ This flag is not compatible with bash nor powershell +_N.B._ This flag is not compatible with powershell ### Brew From d6c4732a18426d4715d9d29a8f19cc397713484e Mon Sep 17 00:00:00 2001 From: Umberto Baldi Date: Thu, 14 Oct 2021 15:13:10 +0200 Subject: [PATCH 20/22] add `-b` or `--fqbn` completion for the monitor command and tests --- cli/monitor/monitor.go | 3 +++ i18n/data/en.po | 22 +++++++++++----------- test/test_completion.py | 4 ++++ 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/cli/monitor/monitor.go b/cli/monitor/monitor.go index 94c1f371f7e..b6639223260 100644 --- a/cli/monitor/monitor.go +++ b/cli/monitor/monitor.go @@ -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 } diff --git a/i18n/data/en.po b/i18n/data/en.po index 41742f18e37..e46325304c4 100644 --- a/i18n/data/en.po +++ b/i18n/data/en.po @@ -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." @@ -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" @@ -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" @@ -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" @@ -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:" @@ -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:" @@ -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" @@ -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" @@ -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" diff --git a/test/test_completion.py b/test/test_completion.py index c36115f04de..2b4410fda6a 100644 --- a/test/test_completion.py +++ b/test/test_completion.py @@ -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", ""]) @@ -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", ""]) From c5ee4d036aa4c08788fdb0d19613460fc8c58490 Mon Sep 17 00:00:00 2001 From: Umberto Baldi Date: Fri, 15 Oct 2021 18:16:49 +0200 Subject: [PATCH 21/22] apply suggestions from code review --- cli/arguments/completion.go | 53 ++++++++++++++++++++++--------------- cli/cli.go | 14 +++++----- cli/lib/check_deps.go | 2 +- cli/lib/examples.go | 2 +- cli/lib/uninstall.go | 2 +- i18n/data/en.po | 20 +++++++------- 6 files changed, 53 insertions(+), 40 deletions(-) diff --git a/cli/arguments/completion.go b/cli/arguments/completion.go index 89ff7b72495..34674e8e57b 100644 --- a/cli/arguments/completion.go +++ b/cli/arguments/completion.go @@ -16,7 +16,7 @@ import ( // It returns a list of fqbn // it's taken from cli/board/listall.go func GetInstalledBoards() []string { - inst := instance.CreateAndInit() // TODO optimize this: it does not make sense to create an instance everytime + inst := instance.CreateAndInit() list, _ := board.ListAll(context.Background(), &rpc.BoardListAllRequest{ Instance: inst, @@ -34,24 +34,25 @@ func GetInstalledBoards() []string { // GetInstalledProtocols is an helper function useful to autocomplete. // It returns a list of protocols available based on the installed boards func GetInstalledProtocols() []string { - inst := instance.CreateAndInit() // TODO optimize this: it does not make sense to create an instance everytime + inst := instance.CreateAndInit() pm := commands.GetPackageManager(inst.Id) boards := pm.InstalledBoards() - // use this strange map because it should be more optimized - // we use only the key and not the value because we do not need it - intalledProtocolsMap := make(map[string]struct{}) + installedProtocols := make(map[string]struct{}) for _, board := range boards { - // we filter and elaborate a bit the informations present in Properties for _, protocol := range board.Properties.SubTree("upload.tool").FirstLevelKeys() { - if protocol != "default" { // remove this value since it's the default one - intalledProtocolsMap[protocol] = struct{}{} + if protocol == "default" { + // default is used as fallback when trying to upload to a board + // using a protocol not defined for it, it's useless showing it + // in autocompletion + continue } + installedProtocols[protocol] = struct{}{} } } - res := make([]string, len(intalledProtocolsMap)) + res := make([]string, len(installedProtocols)) i := 0 - for k := range intalledProtocolsMap { + for k := range installedProtocols { res[i] = k i++ } @@ -61,7 +62,7 @@ func GetInstalledProtocols() []string { // GetInstalledProgrammers is an helper function useful to autocomplete. // It returns a list of programmers available based on the installed boards func GetInstalledProgrammers() []string { - inst := instance.CreateAndInit() // TODO optimize this: it does not make sense to create an instance everytime + inst := instance.CreateAndInit() pm := commands.GetPackageManager(inst.Id) // we need the list of the available fqbn in order to get the list of the programmers @@ -72,8 +73,8 @@ func GetInstalledProgrammers() []string { }) installedProgrammers := make(map[string]string) - for _, i := range list.Boards { - fqbn, _ := cores.ParseFQBN(i.Fqbn) + for _, board := range list.Boards { + fqbn, _ := cores.ParseFQBN(board.Fqbn) _, boardPlatform, _, _, _, _ := pm.ResolveFQBN(fqbn) for programmerID, programmer := range boardPlatform.Programmers { installedProgrammers[programmerID] = programmer.Name @@ -92,7 +93,7 @@ func GetInstalledProgrammers() []string { // GetUninstallableCores is an helper function useful to autocomplete. // It returns a list of cores which can be uninstalled func GetUninstallableCores() []string { - inst := instance.CreateAndInit() // TODO optimize this: it does not make sense to create an instance everytime + inst := instance.CreateAndInit() platforms, _ := core.GetPlatforms(&rpc.PlatformListRequest{ Instance: inst, @@ -110,7 +111,7 @@ func GetUninstallableCores() []string { // GetInstallableCores is an helper function useful to autocomplete. // It returns a list of cores which can be installed/downloaded func GetInstallableCores() []string { - inst := instance.CreateAndInit() // TODO optimize this: it does not make sense to create an instance everytime + inst := instance.CreateAndInit() platforms, _ := core.PlatformSearch(&rpc.PlatformSearchRequest{ Instance: inst, @@ -125,13 +126,23 @@ func GetInstallableCores() []string { return res } -// GetUninstallableLibs is an helper function useful to autocomplete. +// GetInstalledLibraries is an helper function useful to autocomplete. +// It returns a list of libs which are currently installed, including the builtin ones +func GetInstalledLibraries() []string { + return getLibraries(true) +} + +// GetUninstallableLibraries is an helper function useful to autocomplete. // It returns a list of libs which can be uninstalled -func GetUninstallableLibs() []string { - inst := instance.CreateAndInit() // TODO optimize this: it does not make sense to create an instance everytime +func GetUninstallableLibraries() []string { + return getLibraries(false) +} + +func getLibraries(all bool) []string { + inst := instance.CreateAndInit() libs, _ := lib.LibraryList(context.Background(), &rpc.LibraryListRequest{ Instance: inst, - All: false, + All: all, Updatable: false, Name: "", Fqbn: "", @@ -147,7 +158,7 @@ func GetUninstallableLibs() []string { // GetInstallableLibs is an helper function useful to autocomplete. // It returns a list of libs which can be installed/downloaded func GetInstallableLibs() []string { - inst := instance.CreateAndInit() // TODO optimize this: it does not make sense to create an instance everytime + inst := instance.CreateAndInit() libs, _ := lib.LibrarySearch(context.Background(), &rpc.LibrarySearchRequest{ Instance: inst, @@ -165,7 +176,7 @@ func GetInstallableLibs() []string { // It returns a list of boards which are currently connected // Obviously it does not suggests network ports because of the timeout func GetConnectedBoards() []string { - inst := instance.CreateAndInit() // TODO optimize this: it does not make sense to create an instance everytime + inst := instance.CreateAndInit() list, _ := board.List(&rpc.BoardListRequest{ Instance: inst, diff --git a/cli/cli.go b/cli/cli.go index 8723711bfe9..bc4e2d5ea5f 100644 --- a/cli/cli.go +++ b/cli/cli.go @@ -105,18 +105,20 @@ func createCliCommandTree(cmd *cobra.Command) { cmd.AddCommand(version.NewCommand()) cmd.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false, tr("Print the logs on the standard output.")) - cmd.PersistentFlags().String("log-level", "", tr("Messages with this level and above will be logged. Valid levels are: %s", "trace, debug, info, warn, error, fatal, panic")) + validLogLevels := []string{"trace", "debug", "info", "warn", "error", "fatal", "panic"} + cmd.PersistentFlags().String("log-level", "", tr("Messages with this level and above will be logged. Valid levels are: %s", strings.Join(validLogLevels, ", "))) cmd.RegisterFlagCompletionFunc("log-level", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - return []string{"trace", "debug", "info", "warn", "error", "fatal", "panic"}, cobra.ShellCompDirectiveDefault + return validLogLevels, cobra.ShellCompDirectiveDefault }) cmd.PersistentFlags().String("log-file", "", tr("Path to the file where logs will be written.")) - cmd.PersistentFlags().String("log-format", "", tr("The output format for the logs, can be: %s", "text, json")) + validFormats := []string{"text", "json"} + cmd.PersistentFlags().String("log-format", "", tr("The output format for the logs, can be: %s", strings.Join(validFormats, ", "))) cmd.RegisterFlagCompletionFunc("log-format", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - return []string{"text", "json"}, cobra.ShellCompDirectiveDefault + return validFormats, cobra.ShellCompDirectiveDefault }) - cmd.PersistentFlags().StringVar(&outputFormat, "format", "text", tr("The output format for the logs, can be: %s", "text, json")) + cmd.PersistentFlags().StringVar(&outputFormat, "format", "text", tr("The output format for the logs, can be: %s", strings.Join(validFormats, ", "))) cmd.RegisterFlagCompletionFunc("format", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - return []string{"text", "json"}, cobra.ShellCompDirectiveDefault + return validFormats, cobra.ShellCompDirectiveDefault }) cmd.PersistentFlags().StringVar(&configFile, "config-file", "", tr("The custom config file (if not specified the default will be used).")) cmd.PersistentFlags().StringSlice("additional-urls", []string{}, tr("Comma-separated list of additional URLs for the Boards Manager.")) diff --git a/cli/lib/check_deps.go b/cli/lib/check_deps.go index 3e8d0ec57cf..034bd646f48 100644 --- a/cli/lib/check_deps.go +++ b/cli/lib/check_deps.go @@ -41,7 +41,7 @@ func initDepsCommand() *cobra.Command { Args: cobra.ExactArgs(1), Run: runDepsCommand, ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - return arguments.GetUninstallableLibs(), cobra.ShellCompDirectiveDefault + return arguments.GetInstalledLibraries(), cobra.ShellCompDirectiveDefault }, } return depsCommand diff --git a/cli/lib/examples.go b/cli/lib/examples.go index c65f35cd892..482ada066a3 100644 --- a/cli/lib/examples.go +++ b/cli/lib/examples.go @@ -43,7 +43,7 @@ func initExamplesCommand() *cobra.Command { Args: cobra.MaximumNArgs(1), Run: runExamplesCommand, ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - return arguments.GetUninstallableLibs(), cobra.ShellCompDirectiveDefault + return arguments.GetInstalledLibraries(), cobra.ShellCompDirectiveDefault }, } examplesCommand.Flags().StringVarP(&examplesFlags.fqbn, "fqbn", "b", "", tr("Show libraries for the specified board FQBN.")) diff --git a/cli/lib/uninstall.go b/cli/lib/uninstall.go index 6a99a8f2d4c..a520091f0c1 100644 --- a/cli/lib/uninstall.go +++ b/cli/lib/uninstall.go @@ -40,7 +40,7 @@ func initUninstallCommand() *cobra.Command { Args: cobra.MinimumNArgs(1), Run: runUninstallCommand, ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - return arguments.GetUninstallableLibs(), cobra.ShellCompDirectiveDefault + return arguments.GetUninstallableLibraries(), cobra.ShellCompDirectiveDefault }, } return uninstallCommand diff --git a/i18n/data/en.po b/i18n/data/en.po index e46325304c4..6c325eae8f6 100644 --- a/i18n/data/en.po +++ b/i18n/data/en.po @@ -365,7 +365,7 @@ msgstr "Checksum:" msgid "Clean caches." msgstr "Clean caches." -#: cli/cli.go:122 +#: cli/cli.go:124 msgid "Comma-separated list of additional URLs for the Boards Manager." msgstr "Comma-separated list of additional URLs for the Boards Manager." @@ -1214,7 +1214,7 @@ msgstr "Internal error in cache" msgid "Invalid '%[1]s' property: %[2]s" msgstr "Invalid '%[1]s' property: %[2]s" -#: cli/cli.go:263 +#: cli/cli.go:265 msgid "Invalid Call : should show Help, but it is available only in TEXT mode." msgstr "Invalid Call : should show Help, but it is available only in TEXT mode." @@ -1271,11 +1271,11 @@ msgstr "Invalid library" msgid "Invalid network.proxy '%[1]s': %[2]s" msgstr "Invalid network.proxy '%[1]s': %[2]s" -#: cli/cli.go:224 +#: cli/cli.go:226 msgid "Invalid option for --log-level: %s" msgstr "Invalid option for --log-level: %s" -#: cli/cli.go:241 +#: cli/cli.go:243 msgid "Invalid output format: %s" msgstr "Invalid output format: %s" @@ -1444,7 +1444,7 @@ msgstr "Maintainer: %s" msgid "Max time to wait for port discovery, e.g.: 30s, 1m" msgstr "Max time to wait for port discovery, e.g.: 30s, 1m" -#: cli/cli.go:108 +#: cli/cli.go:109 msgid "Messages with this level and above will be logged. Valid levels are: %s" msgstr "Messages with this level and above will be logged. Valid levels are: %s" @@ -1667,7 +1667,7 @@ msgstr "Package website:" msgid "Paragraph: %s" msgstr "Paragraph: %s" -#: cli/cli.go:112 +#: cli/cli.go:113 msgid "Path to the file where logs will be written." msgstr "Path to the file where logs will be written." @@ -2044,7 +2044,7 @@ msgstr "The connected devices search timeout, raise it if your board doesn't sho msgid "The connected devices search timeout, raise it if your board doesn't show up e.g.: 10s" msgstr "The connected devices search timeout, raise it if your board doesn't show up e.g.: 10s" -#: cli/cli.go:121 +#: cli/cli.go:123 msgid "The custom config file (if not specified the default will be used)." msgstr "The custom config file (if not specified the default will be used)." @@ -2064,8 +2064,8 @@ msgid "The key '%[1]v' is not a list of items, can't remove from it.\n" msgstr "The key '%[1]v' is not a list of items, can't remove from it.\n" "Maybe use '%[2]s'?" -#: cli/cli.go:113 -#: cli/cli.go:117 +#: cli/cli.go:115 +#: cli/cli.go:119 msgid "The output format for the logs, can be: %s" msgstr "The output format for the logs, can be: %s" @@ -2147,7 +2147,7 @@ msgstr "Unable to get Local App Data Folder: %v" msgid "Unable to get user home dir: %v" msgstr "Unable to get user home dir: %v" -#: cli/cli.go:210 +#: cli/cli.go:212 msgid "Unable to open file for logging: %s" msgstr "Unable to open file for logging: %s" From d6d4502f12fb1c7a27c395c0a4cf177ca722a8bd Mon Sep 17 00:00:00 2001 From: Umberto Baldi Date: Mon, 18 Oct 2021 12:02:04 +0200 Subject: [PATCH 22/22] fixes after rebase --- i18n/data/en.po | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/i18n/data/en.po b/i18n/data/en.po index 6c325eae8f6..5234bddf2d1 100644 --- a/i18n/data/en.po +++ b/i18n/data/en.po @@ -70,7 +70,7 @@ msgstr "%s pattern is missing" msgid "%s uninstalled" msgstr "%s uninstalled" -#: commands/errors.go:658 +#: commands/errors.go:671 msgid "'%s' has an invalid signature" msgstr "'%s' has an invalid signature" @@ -247,6 +247,10 @@ msgstr "Builds of 'core.a' are saved into this path to be cached and reused." msgid "Can't create data directory %s" msgstr "Can't create data directory %s" +#: commands/errors.go:377 +msgid "Can't create sketch" +msgstr "Can't create sketch" + #: commands/lib/download.go:60 #: commands/lib/download.go:63 #: commands/lib/download.go:65 @@ -260,7 +264,7 @@ msgstr "Can't download library" msgid "Can't find dependencies for platform %s" msgstr "Can't find dependencies for platform %s" -#: commands/errors.go:377 +#: commands/errors.go:390 msgid "Can't open sketch" msgstr "Can't open sketch" @@ -294,11 +298,11 @@ msgstr "Cannot create config file directory: %v" msgid "Cannot create config file: %v" msgstr "Cannot create config file: %v" -#: commands/errors.go:621 +#: commands/errors.go:634 msgid "Cannot create temp dir" msgstr "Cannot create temp dir" -#: commands/errors.go:639 +#: commands/errors.go:652 msgid "Cannot create temp file" msgstr "Cannot create temp file" @@ -448,10 +452,6 @@ msgstr "Could not connect via HTTP" msgid "Could not create index directory" msgstr "Could not create index directory" -#: cli/sketch/new.go:58 -msgid "Could not create sketch directory: %v" -msgstr "Could not create sketch directory: %v" - #: legacy/builder/phases/core_builder.go:48 msgid "Couldn't deeply cache core build: {0}" msgstr "Couldn't deeply cache core build: {0}" @@ -465,8 +465,8 @@ msgstr "Couldn't determine program size" msgid "Couldn't get current working directory: %v" msgstr "Couldn't get current working directory: %v" -#: cli/sketch/new.go:32 -#: cli/sketch/new.go:33 +#: cli/sketch/new.go:35 +#: cli/sketch/new.go:36 msgid "Create a new Sketch" msgstr "Create a new Sketch" @@ -655,8 +655,8 @@ msgstr "Error creating output dir" msgid "Error creating sketch archive" msgstr "Error creating sketch archive" -#: cli/sketch/new.go:54 -#: cli/sketch/new.go:64 +#: cli/sketch/new.go:50 +#: cli/sketch/new.go:59 msgid "Error creating sketch: %v" msgstr "Error creating sketch: %v" @@ -1344,7 +1344,7 @@ msgstr "Library '%s' not found" msgid "Library can't use both '%[1]s' and '%[2]s' folders. Double check {0}" msgstr "Library can't use both '%[1]s' and '%[2]s' folders. Double check {0}" -#: commands/errors.go:414 +#: commands/errors.go:427 msgid "Library install failed" msgstr "Library install failed" @@ -1741,7 +1741,7 @@ msgstr "Port" msgid "Port closed:" msgstr "Port closed:" -#: commands/errors.go:508 +#: commands/errors.go:521 msgid "Port monitor error" msgstr "Port monitor error" @@ -1978,7 +1978,7 @@ msgstr "Size (bytes):" msgid "Sketch cannot be located in build path. Please specify a different build path" msgstr "Sketch cannot be located in build path. Please specify a different build path" -#: cli/sketch/new.go:68 +#: cli/sketch/new.go:63 msgid "Sketch created in: %s" msgstr "Sketch created in: %s"