Debian Codegraph @

guide/src/cli/completions.md

raw
1 # The completions command
2
3 The completions command is used to generate auto-completions for some common shells.
4 This means when you type `mdbook` in your shell, you can then press your shell's auto-complete key (usually the Tab key) and it may display what the valid options are, or finish partial input.
5
6 The completions first need to be installed for your shell:
7
8 ```bash
9 # bash
10 mdbook completions bash > ~/.local/share/bash-completion/completions/mdbook
11 # oh-my-zsh
12 mdbook completions zsh > ~/.oh-my-zsh/completions/_mdbook
13 autoload -U compinit && compinit
14 ```
15
16 The command prints a completion script for the given shell.
17 Run `mdbook completions --help` for a list of supported shells.
18
19 Where to place the completions depend on which shell you are using and your operating system.
20 Consult your shell's documentation for more information one where to place the script.