Elemental CMS supports tab completion for commands and snippet names.
After installing elemental-cms via pip, the completion scripts are included in the package.
Find where the package was installed and run the enable script:
# Find the installation directory
ELEMENTAL_DIR=$(python -c "import elementalcms, os; print(os.path.dirname(elementalcms.__file__))")
cd $ELEMENTAL_DIR/..
# Run the enable script
bash enable-completion.shOr simply:
# One-liner
bash $(python -c "import elementalcms, os; print(os.path.join(os.path.dirname(os.path.dirname(elementalcms.__file__)), 'enable-completion.sh'))")Alternatively, download and run the enable script:
curl -O https://raw.githubusercontent.com/paranoid-software/elemental-cms/main/enable-completion.sh
chmod +x enable-completion.sh
./enable-completion.shThen reload your shell:
source ~/.zshrc # for Zsh
# or
source ~/.bashrc # for BashIf you prefer to set it up manually:
_ELEMENTAL_CMS_COMPLETE=zsh_source elemental-cms > ~/.elemental-cms-complete.zsh
echo '. ~/.elemental-cms-complete.zsh' >> ~/.zshrc
source ~/.zshrc_ELEMENTAL_CMS_COMPLETE=bash_source elemental-cms > ~/.elemental-cms-complete.bash
echo '. ~/.elemental-cms-complete.bash' >> ~/.bashrc
source ~/.bashrc_ELEMENTAL_CMS_COMPLETE=fish_source elemental-cms > ~/.config/fish/completions/elemental-cms.fishOnce enabled, you can use tab completion:
elemental-cms <TAB> # Shows available commands
elemental-cms snippets <TAB> # Shows snippet subcommands
elemental-cms snippets diff -s <TAB> # Shows available snippet namesTo disable completion:
./disable-completion.shOr manually remove the completion loading from your shell config file (~/.zshrc, ~/.bashrc, etc.).
Make sure elemental-cms is installed and in your PATH:
pip install elemental-cms
# or for development
pip install -e .Make sure your .zshrc initializes the completion system before loading elemental-cms completion:
autoload -Uz compinit && compinit
. ~/.elemental-cms-complete.zshThe enable-completion.sh script handles this automatically.