|
Home > Archive > Unix Shell > February 2005 > tab completion for make targets on the command line?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
tab completion for make targets on the command line?
|
|
| Markus Dehmann 2005-02-26, 2:50 am |
| I often type make commands, using Makefiles that have meaningful
pseudo-target names like:
experiment1-verbose: $(EXE)
$(EXE) -v experiment1.dat > experiment.log
Something like that.
Now I am in the shell (actually I use bash), and type:
$ make exp[tab]
and it would be great if the shell could examine the Makefile and do the
tab-completion for me!
$ make experiment1-verbose
Is there something like that? Or is there a trick to implement it?
Thanks
Markus
| |
| Markus Dehmann 2005-02-26, 2:50 am |
| Markus Dehmann wrote:
> I often type make commands, using Makefiles that have meaningful
> pseudo-target names like:
>
> experiment1-verbose: $(EXE)
> $(EXE) -v experiment1.dat > experiment.log
>
> Something like that.
>
> Now I am in the shell (actually I use bash), and type:
> $ make exp[tab]
>
> and it would be great if the shell could examine the Makefile and do the
> tab-completion for me!
> $ make experiment1-verbose
>
> Is there something like that? Or is there a trick to implement it?
I found it myself:
http://www.caliban.org/bash/#completion
It works great! I can only recommend everyone to install it. It also
completes hostnames after you type ssh. If you type cvs [tab] it gives you
the options "checkout commit ...".
And for my make targets it does exactly what I (and probably many other
people) need.
Markus
| |
| Chris F.A. Johnson 2005-02-26, 2:50 am |
| On Sat, 26 Feb 2005 at 04:13 GMT, Markus Dehmann wrote:
> I often type make commands, using Makefiles that have meaningful
> pseudo-target names like:
>
> experiment1-verbose: $(EXE)
> $(EXE) -v experiment1.dat > experiment.log
>
> Something like that.
>
> Now I am in the shell (actually I use bash), and type:
> $ make exp[tab]
>
> and it would be great if the shell could examine the Makefile and do the
> tab-completion for me!
> $ make experiment1-verbose
>
> Is there something like that? Or is there a trick to implement it?
Put this in your .bashrc (it may require some tweaking):
_mk()
{
local IFS=$'\n'
COMPREPLY=(
$( grep -h "^${COMP_WORDS[$COMP_CWORD]:-.}.*:" [mM]akefile |
cut -d: -f1 )
)
}
complete -F _mk make
--
Chris F.A. Johnson http://cfaj.freeshell.org/shell
========================================
===========================
My code (if any) in this post is copyright 2005, Chris F.A. Johnson
and may be copied under the terms of the GNU General Public License
|
|
|
|
|