Mac OS X中类似Ubuntu的bash完成?


12

我在终端上工作的相当多,而我通常在工作的服务器上确实想念的一件事是Ubuntu服务器上提供的全面的自动补全bash。

是否有任何现成的工具可以为Mac添加类似的完成度;至少包含内置系统实用程序和开发人员工具(如git,xcodebuild等)的命令行参数?

Answers:


14

最简单的方法是bash-completion自制程序安装并按照提供的说明进行操作。

输出示例:

==> Downloading https://homebrew.bintray.com/bottles/bash-completion-1.3.mavericks.bottle.tar.gz
######################################################################## 100.0%
==> Pouring bash-completion-1.3.mavericks.bottle.tar.gz
==> Caveats
Add the following lines to your ~/.bash_profile:
    if [ -f "$(brew --prefix)/etc/bash_completion" ]; then
        source "$(brew --prefix)/etc/bash_completion"
    fi

The Homebrew bash completion script has been installed to:
    /usr/local/etc/bash_completion.d

Bash completion has been installed to:
    /usr/local/etc/bash_completion.d
==> Summary
🍺  /usr/local/Cellar/bash-completion/1.3: 188 files, 1.1M

完成后,您可以在下创建自己的脚本/usr/local/etc/bash_completion.d/

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.