Many times I end up writting wrapper function around existing ones, for instance:
function gl {
some_computed_stuff=...
git --no-pager log --reverse $some_computed_stuff "$@"
}
function m {
make "$@" && notify-send success || notify-send failed
}
I know that aliases keep autocompletion but sometimes functions are required and in that case autocompletion is lost.
For instance here I would like to keep git log
completion for my function gl
or make
completion for m
.
I tried to add compctl -K _git gl
but no suggestions are made. It won't work anyway since I must somehow find how to provide log
argument to _git
autocompletion script as well, so my question is:
Is there a way to make ZSH (but also bash) understand that typing gl
is the exact equivalent of git log
? Something like (for ZSH only):
compctl 'git log' gl
compctl 'make' m