bash功能保留制表符完成 [英] bash function preserving tab completion

查看:83
本文介绍了bash功能保留制表符完成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我放了函数

make_color() {
    make $1 | ccze -A
}

.bashrc中的

以获得彩色的make-output.他的工作正常,但是make用于选择目标的制表符丢失.有什么方法可以在函数中保留命令的制表符补全,或者我可以做一些其他事情来实现制表符的完成和管道化?

in .bashrc to get colorized make-output. His works fine, but makes tab-completion for selecting targets is lost. Is there any way to preserve the tab-completion of command in the function, or something else I could do to achieve tab completion and pipe?

推荐答案

将此添加到您的~/.bashrc中或在您的本地shell中运行:

Add this in your ~/.bashrc or run in your local shell:

complete -F _make make_color 

函数名称_make可能与您的情况不同. 您可以使用以下名称获取名称:

The function name _make may be different in your case. You can get the name using:

$ complete -p make
complete -F _make make

这篇关于bash功能保留制表符完成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆