Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: completions for make targets?

Raju K. V. <rajukv@xxxxxxxxxxxxxxxx> wrote:
> Hi all,
> I am a zsh newbie still struggling to understand the power of compctl. I
> have one requirement. How can I use compctl to complate make targets? I
> can illustrate my requirements:
> suppose I have 'Makefile' in my current directory with targets
> xx:
> yy:
> zz:
> clean:
> clobber:
> now I want to program compctl in such a way that $make <TAB> will list all
> the targets for make.
> Any help will be welcome.

Well, there is a tool to convert tcsh complete commands to zsh compctl
statements. Using that, I got this solution (sorry for the *long* line):

compctl -s '`cat -s GNUmakefile Makefile makefile |& sed -n -e "/No such file/d" -e "/^[^ #].*:/s/:.*//p"`' -x 'c[-1,-f]' -f - 'n[-1,=]' -f -- make

> Thanks and regards,
> Raju


> p.s.: Since I am not subscribed to the list, please CC me in your replies.

No problem. :-)

    Thomas Köhler    Email:     jean-luc@xxxxxxxxxxxxxxxxx
        <><           WWW:    http://home.pages.de/~jeanluc/
                      IRC:               jeanluc
      LCARS --- Linux for Computers on All Real Starships

Messages sorted by: Reverse Date, Date, Thread, Author