Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

bash function preserving tab completion

I put the function

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

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

like image 718
Jonatan Öström Avatar asked Sep 18 '25 16:09

Jonatan Öström


1 Answers

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

complete -F _make make_color 

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

$ complete -p make
complete -F _make make
like image 59
anishsane Avatar answered Sep 21 '25 08:09

anishsane