Shell Completion Setup¶
This guide will walk you through enabling shell completion for fm-weck, in order to make it easier to navigate through its options and arguments. For an in-depth explanation of how argcomplete works, refer to its documentation.
Activating the Tool¶
To be able to use the shell completion for fm-weck, you need to have the package argcomplete installed in your environment. If you installed fm-weck through pip you should already have argcomplete installed. To check you can run:
pip install argcomplete
After that, run the command:
activate-global-python-argcomplete
This script installs the global completion script bash_completion.d/_python-argcomplete into an appropriate location on your system for both bash and zsh.
Keep in mind that the shell completion only works for the environment the scripts were installed into.
After the activation refresh your shell environment (start a new shell).
Enabling Completion¶
After the scripts have been installed, the final step is to register fm-weck with your shell’s completion framework by running register-python-argcomplete:
eval "$(register-python-argcomplete fm-weck)"
After this step the shell completion for fm-weck should work.
If after a certain point the completion stops working (possibly due to own changes made to the cli source code), it is enough to register fm-weck again using this command. The activate-global-python-argcomplete is only needed to be run once, since it permanently creates the necessary scripts in the working environment.