symfony 自动补全

Static installation


Dump the script to a global completion file and restart your shell:

  bin/console completion bash | sudo tee /etc/bash_completion.d/console

Or dump the script to a local file and source it:

  bin/console completion bash > completion.sh

  # source the file whenever you use the project
  source completion.sh

  # or add this line at the end of your "~/.bashrc" file:
  source /path/to/completion.sh

Dynamic installation


Add this to the end of your shell configuration file (e.g. “~/.bashrc”):

  eval "$(/root/mytest/bin/console completion bash)"

symfony 命令自动补全的出现了错误, -bash: _get_comp_words_by_ref: command not found 。

问题原因:缺少bash-completion工具

解决方案:

安装bash-completion:# yum install bash-completion -y

执行bash-completion:# source /usr/share/bash-completion/bash_completion

重新加载~/.bashrc:# source ~/.bashrc

留言

您的电子邮箱地址不会被公开。