Skip to content

Latest commit

 

History

History
42 lines (30 loc) · 2.35 KB

command-line-completion.md

File metadata and controls

42 lines (30 loc) · 2.35 KB

arduino-cli supports also command-line completion (also known as tab completion) for basic commands. Currently only bash, zsh, fish shells are supported

Before you start

In order to generate the file required to make the completion work you have to install the arduino-cli first.

Generate the completion file

To generate the completion file you can use arduino-cli completion [bash|zsh|fish] [--no-descriptions]. 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 > redirect symbol.

Bash

Use arduino-cli completion bash > arduino-cli.sh to generate the completion file. At this point you can moove that file in /etc/bash_completion.d/ (root access is required) with sudo mv arduino-cli.sh /etc/bash_completion.d/.

A not recommended alternative is to source the completion file in .bashrc. Remember to open a new shell to test the functionality

Zsh

Use arduino-cli completion zsh > _arduino-cli to generate the completion file. At this point you can place the file in a directory listed in yout fpath if you have already created a directory to store your completion.

Or if you want you can create a directory, add it to your fpath and copy the file in it:

  1. mkdir ~/completion_zsh
  2. add fpath=($HOME/completion_zsh $fpath) at the beginning of your .zshrc file
  3. mv _arduino-cli ~/completion_zsh/ Remember to open a new shell to test the functionality

N.B. The ZSH completion is working with Oh-My-Zsh but not with Prezto (the zsh completion system is working in a different way than classic zsh). But hopefully it will be fixed in the future

Fish

Use arduino-cli completion fish > arduino-cli.fish to generate the completion file. At this point you can place the file in ~/.config/fish/completions with mv arduino-cli.fish ~/.config/fish/completions/ Remember to open a new shell to test the functionality

Disabling command and flag descriptions

By default fish completion has command and flag description enabled by default. If you want to disable this behaviour you can simply pass --no-descriptions flag when calling completion command and the generated file will not have descriptions

N.B. This flags is not compatible with bash or zsh