如何对别名使用Bazel bash自动补全功能?

时间:2018-12-18 20:37:06

标签: bash autocomplete bazel

/etc/bash_completion.d/bazel中有注释:

 454 # Some users have aliases such as bt="bazel test" or bb="bazel build", this
 455 # completion function allows them to have auto-completion for these aliases.
 456 _bazel__complete_target_stdout() {

例如,这如何用于自动完成bb="bazel build"

1 个答案:

答案 0 :(得分:-1)

我的解决方案是将此内容附加到/etc/bash_completion.d/bazel中:

_my_bb_alias_autocomplete() {
  _bazel__complete_target_stdout "build"
}
complete -F _my_bb_alias_autocomplete -o nospace bb