Pmbootstrap/Tab Completion

From postmarketOS Wiki
(Redirected from Pmbootstrap: Tab Completion)

Frequent users of pmbootstrap may want to set up tab completion to automatically complete your commands and arguments when pressing tab. Pressing it twice also lists possible arguments.

Install argcomplete

Install argcomplete with your distribution's package manager:

Alpine Linux, postmarketOS:
# apk add py3-argcomplete
Arch Linux:
# pacman -S python-argcomplete
Debian, Ubuntu:
# apt install python3-argcomplete
Fedora:
# dnf install python3-argcomplete
Gentoo:
# emerge dev-python/argcomplete

Or in the unlikely case that your distribution does not have it packaged:

$ pip3 install --user argcomplete

Next, do one of the following depending on the shell you use.

Bash

Add the following line to ~/.bashrc:

eval "$(register-python-argcomplete pmbootstrap)"

For Ubuntu 20.04+:

eval "$(register-python-argcomplete3 pmbootstrap)"

Then reload your configuration by opening a new terminal or by running source ~/.bashrc.

Zsh

Add the following lines to ~/.zshrc:

autoload bashcompinit
bashcompinit
eval "$(register-python-argcomplete pmbootstrap)"

Then reload your configuration by opening a new terminal or by running source ~/.zshrc.

Fish

Run the following to add an autocomplete file for pmbootstrap:

register-python-argcomplete --shell fish pmbootstrap > ~/.config/fish/completions/pmbootstrap.fish

See also