本文介绍了如何在Mac OS X上为Docker添加bash命令完成功能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行docker,我想为docker命令和参数完成bash命令.

I am running docker and I want bash command completion for docker commands and parameters.

推荐答案

如果您已经自制 bash-completion 已安装,只需将Docker完成脚本安装到bash_completion.d

If you have already homebrew bash-completion installed just install the docker completion script into the bash_completion.d

curl -XGET https://raw.githubusercontent.com/docker/cli/master/contrib/completion/bash/docker > $(brew --prefix)/etc/bash_completion.d/docker

注意:如果您没有安装自制软件bash-completion,请进行安装,然后再执行上面的代码.

Note: If you do not have homebrew bash-completion installed, follow these instructions to install it before you execute the line above.

注意:完成情况取决于 debian bash-completion中定义的某些功能.因此,只需按照 completion/bash/docker 可能无法正常工作.如果尝试完成docker run(通过按TAB键),则可能会出现类似__ltrim_colon_completions: command not found的错误.这可能意味着您尚未安装bash-completion脚本.

Note: the completion depends on some functions defined in debian bash-completion. Therefore, just sourcing the docker completion script as described in completion/bash/docker may not work. If you try to complete docker run (by hitting TAB) you may get an error like __ltrim_colon_completions: command not found. This could mean that you have not installed the bash-completion scripts.

这篇关于如何在Mac OS X上为Docker添加bash命令完成功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-24 22:49