shell-completion.md 1007 Bytes
Newer Older
1

2
## Shell completion
3
4
5
6
7

The Polkadot cli command supports shell auto-completion. For this to work, you will need to run the completion script matching you build and system.

Assuming you built a release version using `cargo build --release` and use `bash` run the following:

8
```bash
9
source target/release/completion-scripts/polkadot.bash
10
```
11
12

You can find completion scripts for:
13

14
15
16
17
18
19
20
21
- bash
- fish
- zsh
- elvish
- powershell

To make this change persistent, you can proceed as follow:

22
### First install
23

24
```bash
25
26
27
28
29
COMPL_DIR=$HOME/.completion
mkdir -p $COMPL_DIR
cp -f target/release/completion-scripts/polkadot.bash $COMPL_DIR/
echo "source $COMPL_DIR/polkadot.bash" >> $HOME/.bash_profile
source $HOME/.bash_profile
30
```
31

32
### Update
33
34
35

When you build a new version of Polkadot, the following will ensure you auto-completion script matches the current binary:

36
```bash
37
38
39
40
COMPL_DIR=$HOME/.completion
mkdir -p $COMPL_DIR
cp -f target/release/completion-scripts/polkadot.bash $COMPL_DIR/
source $HOME/.bash_profile
41
```