Thursday, 25 June 2020

The Arduino CLI just got some new exciting features | Arduino Blog

The arduino-cli tool just got some new exciting features with the release of 0.11.0:

  • Command-line completion
  • External programmer support
  • Internationalization and localization support (i18n)

Command-line completion

Finally, the autocompletion feature has landed!

With this functionality, the program automatically fills in partially typed commands by pressing the tab key. For example, with this update, you can type “arduino-cli bo”:

And, after pressing the <TAB> key, the command will auto-magically become: 

There are a few steps to follow in order to make it work seamlessly. We have to generate the required file — to do so, we have added a new command named “completion”. 

To generate the completion file, you can use:

By default, this command will print on the standard output (the shell window) the content of the completion file. To save to an actual file, use the “>” redirect symbol. Now you can move it to the required location (it depends on the shell you are using). Remember to open a new shell! Finally, you can press <TAB><TAB> to get the suggested command and flags.

In a future release, we will also be adding the completion for cores names, libraries, and boards.

Example with Bash (from the documentation)

To generate the completion file, use:

At this point, you can move that file in “/etc/bash_completion.d/” (root access is required) with:

A not recommended alternative is to source the completion file in `.bashrc`.

Remember to open a new shell to test the functionality.

External programmer

Another brand new feature is support for external programmers!

Now you can specify the external programmer to use when uploading code to a board. For example, you can use `arduino-cli upload …. –programmer programmer-id` for that. You can list the supported programmers with `arduino-cli upload –fqbn arduino:avr:uno –programmer list`.

And if you’re using the external programmer to burn a bootloader, you can do that from arduino-cli as well: `arduino-cli burn-bootloader –fqbn …`

Internationalization and localization support

Now the Arduino CLI messages can be translated to your native language thanks to i18n support! We are currently setting up the infrastructure; however, if you would like to help us with the translation, we will provide you more details in another blog post soon!

That’s all folks!

That’s it, we’ve worked hard to add these new features. Check them out by downloading 0.11.0 here. Do you like them? What are your thoughts on the arduino-cli? Are you using it for your projects? Let us know in the comments!

No comments:

Post a Comment