diff --git a/cli/arguments/completion.go b/cli/arguments/completion.go new file mode 100644 index 00000000000..34674e8e57b --- /dev/null +++ b/cli/arguments/completion.go @@ -0,0 +1,190 @@ +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" + "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" +) + +// GetInstalledBoards is an helper function useful to autocomplete. +// It returns a list of fqbn +// it's taken from cli/board/listall.go +func GetInstalledBoards() []string { + inst := instance.CreateAndInit() + + 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.Boards { + res = append(res, i.Fqbn+"\t"+i.Name) + } + return res +} + +// 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() + pm := commands.GetPackageManager(inst.Id) + boards := pm.InstalledBoards() + + installedProtocols := make(map[string]struct{}) + for _, board := range boards { + for _, protocol := range board.Properties.SubTree("upload.tool").FirstLevelKeys() { + 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(installedProtocols)) + i := 0 + for k := range installedProtocols { + res[i] = k + i++ + } + return res +} + +// 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() + 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, + }) + + installedProgrammers := make(map[string]string) + for _, board := range list.Boards { + fqbn, _ := cores.ParseFQBN(board.Fqbn) + _, boardPlatform, _, _, _, _ := pm.ResolveFQBN(fqbn) + for programmerID, programmer := range boardPlatform.Programmers { + installedProgrammers[programmerID] = programmer.Name + } + } + + res := make([]string, len(installedProgrammers)) + i := 0 + for programmerID := range installedProgrammers { + res[i] = programmerID + "\t" + installedProgrammers[programmerID] + i++ + } + return res +} + +// GetUninstallableCores is an helper function useful to autocomplete. +// It returns a list of cores which can be uninstalled +func GetUninstallableCores() []string { + inst := instance.CreateAndInit() + + 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.Id+"\t"+i.Name) + } + return res +} + +// 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() + + 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.Id+"\t"+i.Name) + } + return res +} + +// 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 GetUninstallableLibraries() []string { + return getLibraries(false) +} + +func getLibraries(all bool) []string { + inst := instance.CreateAndInit() + libs, _ := lib.LibraryList(context.Background(), &rpc.LibraryListRequest{ + Instance: inst, + All: all, + Updatable: false, + Name: "", + Fqbn: "", + }) + var res []string + // transform the data structure for the completion + for _, i := range libs.InstalledLibraries { + res = append(res, i.Library.Name+"\t"+i.Library.Sentence) + } + return res +} + +// 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() + + 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+"\t"+i.Latest.Sentence) + } + 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() []string { + inst := instance.CreateAndInit() + + 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 b4643b1039a..c723335efcd 100644 --- a/cli/arguments/port.go +++ b/cli/arguments/port.go @@ -42,7 +42,13 @@ 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(), 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(), 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 87f9b975e4f..abe5234ab3f 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(), 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..7a1ea0db27f 100644 --- a/cli/burnbootloader/burnbootloader.go +++ b/cli/burnbootloader/burnbootloader.go @@ -51,10 +51,16 @@ 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(), 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(), 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/cli.go b/cli/cli.go index 14f072f8f6e..bc4e2d5ea5f 100644 --- a/cli/cli.go +++ b/cli/cli.go @@ -105,10 +105,21 @@ 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 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")) - cmd.PersistentFlags().StringVar(&outputFormat, "format", "text", 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 validFormats, cobra.ShellCompDirectiveDefault + }) + 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 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.")) cmd.PersistentFlags().Bool("no-color", false, "Disable colored output.") diff --git a/cli/compile/compile.go b/cli/compile/compile.go index 2c8f26b5fba..ead85347530 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(), 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,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(), 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. @@ -276,19 +278,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/config/add.go b/cli/config/add.go index da5096fa5f9..4f7ddbeeedb 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 GetConfigurationKeys(), cobra.ShellCompDirectiveDefault + }, } return addCommand } diff --git a/cli/config/config.go b/cli/config/config.go index b91a0ddb7d5..41a03c60028 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() []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/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..f7fa1e2bc4e 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 GetConfigurationKeys(), 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/cli/core/download.go b/cli/core/download.go index 1ca0ab1e20f..30b21110241 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(), cobra.ShellCompDirectiveDefault + }, } return downloadCommand } diff --git a/cli/core/install.go b/cli/core/install.go index d36fa5c753d..44475c93ef9 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(), cobra.ShellCompDirectiveDefault + }, } AddPostInstallFlagsToCommand(installCommand) return installCommand diff --git a/cli/core/uninstall.go b/cli/core/uninstall.go index fb71468d84e..86ac1af5c9b 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(), cobra.ShellCompDirectiveDefault + }, } } diff --git a/cli/debug/debug.go b/cli/debug/debug.go index b1be9760bc0..0a2afd1c4cc 100644 --- a/cli/debug/debug.go +++ b/cli/debug/debug.go @@ -59,8 +59,14 @@ 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(), 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(), 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/lib/check_deps.go b/cli/lib/check_deps.go index 7dce28b0a2c..034bd646f48 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.GetInstalledLibraries(), cobra.ShellCompDirectiveDefault + }, } return depsCommand } diff --git a/cli/lib/download.go b/cli/lib/download.go index 861fa0592d7..f76e6a77686 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(), cobra.ShellCompDirectiveDefault + }, } return downloadCommand } diff --git a/cli/lib/examples.go b/cli/lib/examples.go index 69c205b29c1..482ada066a3 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" @@ -41,8 +42,14 @@ 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.GetInstalledLibraries(), 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(), cobra.ShellCompDirectiveDefault + }) return examplesCommand } diff --git a/cli/lib/install.go b/cli/lib/install.go index b8637951333..5f1865bed42 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(), 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/cli/lib/uninstall.go b/cli/lib/uninstall.go index 1a00da8a557..a520091f0c1 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.GetUninstallableLibraries(), cobra.ShellCompDirectiveDefault + }, } return uninstallCommand } 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/cli/upload/upload.go b/cli/upload/upload.go index 27449de122a..6fe40ab15f3 100644 --- a/cli/upload/upload.go +++ b/cli/upload/upload.go @@ -55,12 +55,18 @@ 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(), 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.")) 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(), 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 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 diff --git a/i18n/data/en.po b/i18n/data/en.po index c2c77175b40..5234bddf2d1 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." @@ -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." @@ -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." @@ -185,8 +185,8 @@ msgstr "Arduino configuration commands." msgid "Arduino core operations." msgstr "Arduino core operations." -#: cli/lib/check_deps.go:50 -#: cli/lib/install.go:119 +#: cli/lib/check_deps.go:54 +#: cli/lib/install.go:123 msgid "Arguments error: %v" msgstr "Arguments error: %v" @@ -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,7 +239,7 @@ 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." @@ -268,7 +268,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" @@ -276,9 +276,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" @@ -344,8 +344,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." @@ -361,7 +361,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 +369,7 @@ msgstr "Checksum:" msgid "Clean caches." msgstr "Clean caches." -#: cli/cli.go:113 +#: 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." @@ -382,8 +382,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." @@ -415,7 +415,7 @@ msgstr "Config file written to: %s" msgid "Configuration of the port." msgstr "Configuration of the port." -#: cli/debug/debug.go:153 +#: cli/debug/debug.go:159 msgid "Configuration options for %s" msgstr "Configuration options for %s" @@ -431,7 +431,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." @@ -461,7 +461,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" @@ -492,7 +492,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:70 msgid "Debug interpreter e.g.: %s" msgstr "Debug interpreter e.g.: %s" @@ -500,11 +500,11 @@ 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 +#: cli/monitor/monitor.go:195 msgid "Default" msgstr "Default" @@ -541,11 +541,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:71 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." @@ -565,12 +565,12 @@ 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." -#: cli/burnbootloader/burnbootloader.go:58 -#: cli/upload/upload.go:64 +#: 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" @@ -597,8 +597,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." @@ -606,11 +606,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" @@ -665,8 +665,8 @@ msgstr "Error creating sketch: %v" msgid "Error detecting boards: %v" msgstr "Error detecting boards: %v" -#: cli/core/download.go:68 -#: cli/lib/download.go:62 +#: cli/core/download.go:71 +#: cli/lib/download.go:66 msgid "Error downloading %[1]s: %[2]v" msgstr "Error downloading %[1]s: %[2]v" @@ -710,9 +710,9 @@ msgstr "Error downloading platform %s" 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:87 +#: cli/debug/debug.go:92 +#: cli/debug/debug.go:121 msgid "Error during Debug: %v" msgstr "Error during Debug: %v" @@ -720,28 +720,28 @@ 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/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:117 -#: cli/upload/upload.go:144 +#: 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:259 +#: cli/compile/compile.go:261 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" -#: cli/core/uninstall.go:68 +#: cli/core/uninstall.go:71 msgid "Error during uninstall: %v" msgstr "Error during uninstall: %v" @@ -757,7 +757,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:108 msgid "Error getting Debug info: %v" msgstr "Error getting Debug info: %v" @@ -765,7 +765,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,11 +786,11 @@ 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:76 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" @@ -805,15 +805,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" @@ -837,7 +837,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:152 msgid "Error opening source code overrides data file: %v" msgstr "Error opening source code overrides data file: %v" @@ -857,7 +857,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" @@ -908,7 +908,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" @@ -985,7 +985,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:159 msgid "Error: invalid source code overrides data file: %v" msgstr "Error: invalid source code overrides data file: %v" @@ -993,7 +993,7 @@ msgstr "Error: invalid source code overrides data file: %v" msgid "Event" msgstr "Event" -#: cli/lib/examples.go:118 +#: cli/lib/examples.go:125 msgid "Examples for library %s" msgstr "Examples for library %s" @@ -1001,7 +1001,7 @@ msgstr "Examples for library %s" msgid "Examples:" msgstr "Examples:" -#: cli/debug/debug.go:134 +#: cli/debug/debug.go:140 msgid "Executable to debug" msgstr "Executable to debug" @@ -1011,7 +1011,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 +1019,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 +1067,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:" @@ -1079,28 +1079,28 @@ 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)." -#: 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:154 msgid "GDB Server path" msgstr "GDB Server path" -#: cli/debug/debug.go:147 +#: cli/debug/debug.go:153 msgid "GDB Server type" msgstr "GDB Server type" @@ -1139,21 +1139,21 @@ 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" -#: 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: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." @@ -1201,8 +1201,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." @@ -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:254 +#: 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." @@ -1234,12 +1234,12 @@ 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/uninstall.go:51 +#: 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 -#: cli/lib/uninstall.go:51 +#: cli/lib/download.go:54 +#: cli/lib/uninstall.go:55 msgid "Invalid argument passed: %v" msgstr "Invalid argument passed: %v" @@ -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:215 +#: cli/cli.go:226 msgid "Invalid option for --log-level: %s" msgstr "Invalid option for --log-level: %s" -#: cli/cli.go:232 +#: cli/cli.go:243 msgid "Invalid output format: %s" msgstr "Invalid output format: %s" @@ -1284,7 +1284,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" @@ -1308,7 +1308,7 @@ msgstr "Invalid version" msgid "Invalid vid value: '%s'" msgstr "Invalid vid value: '%s'" -#: cli/compile/compile.go:113 +#: cli/compile/compile.go:115 msgid "Just produce the compilation database, without actually compiling." msgstr "Just produce the compilation database, without actually compiling." @@ -1316,15 +1316,15 @@ msgstr "Just produce the compilation database, without actually compiling." msgid "LIBNAME" msgstr "LIBNAME" -#: cli/lib/check_deps.go:34 -#: cli/lib/install.go:39 +#: cli/lib/check_deps.go:35 +#: cli/lib/install.go:40 msgid "LIBRARY" msgstr "LIBRARY" -#: cli/lib/download.go:34 -#: cli/lib/examples.go:38 +#: cli/lib/download.go:35 +#: 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" @@ -1386,15 +1386,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." @@ -1440,11 +1440,11 @@ msgstr "Low memory available, stability problems may occur." msgid "Maintainer: %s" msgstr "Maintainer: %s" -#: cli/arguments/port.go:46 +#: 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" -#: 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" @@ -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:" @@ -1488,7 +1488,7 @@ msgstr "Monitor port settings:" 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 +1515,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:110 msgid "No libraries found." msgstr "No libraries found." @@ -1577,11 +1577,11 @@ 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:" @@ -1590,37 +1590,37 @@ msgstr "Official Arduino board:" 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: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." -#: 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: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." @@ -1628,7 +1628,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 +1643,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 +1667,11 @@ msgstr "Package website:" msgid "Paragraph: %s" msgstr "Paragraph: %s" -#: cli/cli.go:109 +#: cli/cli.go:113 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." @@ -1703,31 +1703,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,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:" @@ -1750,11 +1750,11 @@ msgstr "Port monitor error" 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." @@ -1774,15 +1774,15 @@ msgstr "Prints the current configuration." 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:" @@ -1812,7 +1812,7 @@ msgstr "Removes one or more values from a setting." 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:" @@ -1836,7 +1836,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,11 +1878,11 @@ 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" -#: 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" @@ -1891,7 +1891,7 @@ 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." @@ -1904,15 +1904,15 @@ msgstr "Show all the settings of the communication port." 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:49 #: cli/lib/list.go:49 msgid "Show libraries for the specified board FQBN." msgstr "Show libraries for the specified board FQBN." @@ -1921,11 +1921,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: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." @@ -1954,11 +1954,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 +1970,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):" @@ -1990,9 +1990,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:142 #: cli/sketch/archive.go:66 -#: cli/upload/upload.go:87 +#: 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:" @@ -2044,28 +2044,28 @@ 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: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)." -#: 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." -#: 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" "Maybe use '%[2]s'?" -#: cli/cli.go:110 -#: cli/cli.go:111 +#: 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" @@ -2097,23 +2097,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:148 msgid "Toolchain custom configurations" msgstr "Toolchain custom configurations" -#: cli/debug/debug.go:136 +#: cli/debug/debug.go:142 msgid "Toolchain path" msgstr "Toolchain path" -#: cli/debug/debug.go:137 +#: cli/debug/debug.go:143 msgid "Toolchain prefix" msgstr "Toolchain prefix" -#: cli/debug/debug.go:135 +#: cli/debug/debug.go:141 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 +2126,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 +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:201 +#: cli/cli.go:212 msgid "Unable to open file for logging: %s" msgstr "Unable to open file for logging: %s" @@ -2169,8 +2169,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." @@ -2265,11 +2265,11 @@ 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" -#: 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 +2281,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: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:" @@ -2294,7 +2294,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." @@ -2348,18 +2348,18 @@ msgstr "Using previously compiled file: {0}" msgid "VERSION" msgstr "VERSION" -#: cli/lib/check_deps.go:34 -#: cli/lib/install.go:39 +#: cli/lib/check_deps.go:35 +#: cli/lib/install.go:40 msgid "VERSION_NUMBER" msgstr "VERSION_NUMBER" -#: cli/monitor/monitor.go:192 +#: cli/monitor/monitor.go:195 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." @@ -2403,7 +2403,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." @@ -2415,7 +2415,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" @@ -2636,7 +2636,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" @@ -2648,7 +2648,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:77 msgid "error: %s and %s flags cannot be used together" msgstr "error: %s and %s flags cannot be used together" @@ -2692,18 +2692,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/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/install.go:44 +#: cli/lib/check_deps.go:40 +#: cli/lib/install.go:45 msgid "for the specific version." msgstr "for the specific version." @@ -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" @@ -3099,7 +3099,7 @@ msgstr "platform %s is not installed" msgid "platform not installed" msgstr "platform not installed" -#: cli/compile/compile.go:124 +#: cli/compile/compile.go:126 msgid "please use --build-property instead." msgstr "please use --build-property instead." @@ -3111,7 +3111,7 @@ msgstr "pluggable discovery already added: %s" msgid "port" msgstr "port" -#: cli/arguments/port.go:137 +#: cli/arguments/port.go:143 msgid "port not found: %[1]s %[2]s" msgstr "port not found: %[1]s %[2]s" diff --git a/test/test_completion.py b/test/test_completion.py index d84a4d05864..2b4410fda6a 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,116 @@ 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", "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", ""]) + 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", "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", ""]) + 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