symfonyautocompletecommand-line-interfaceddev

DDEV: Configure auto completion for symfony based CLI tools ( fe magento )


I am trying to configure auto completion for magento CLI tool in DDEV web container.
For autocompletion I use the package: bamarni/symfony-console-autocomplete.

The package configuration (.ddev/homeadditions/.bashrc.d/autocomplete):

export PATH="$PATH:/usr/local/composer/vendor/bin"
eval "$(symfony-autocomplete)"

and composer packages (.ddev/web-build/Dockerfile):

ENV COMPOSER_HOME="/usr/local/composer"
ENV SHELL="bash"
RUN composer global require consolidation/cgr
RUN $COMPOSER_HOME/vendor/bin/cgr  bamarni/symfony-console-autocomplete
ENV COMPOSER_HOME=""

And when I try:

ddev ssh
magento <TAB>

I got: magento bash: _get_comp_words_by_ref: command not found

Any ideas advises ?


Solution

  • magento bash: _get_comp_words_by_ref: command not found

    bash-completion is not installed by default in the ddev-webserver container.

    It can be added manually with:

    ddev config --webimage-extra-packages bash-completion