It is currently Tue, 30 Nov 2021 18:02:43 GMT



 
Author Message
 nice tcsh complete for 'make'

Hi all,

I just struggled a bit to come up with a nice completion for the make
command in tcsh.  And now that I seem to have it working reasonably well,
I figured I'd post it, have some people try it out and possibly suggest
improvements.  Also, maybe it will inspire others to post some cool tips,
instead of just problems...

Put this all on a single line.  What looks like a bunch of spaces after
the # sign is actually a tab character:

Type 'make ' and press <Control-D>.  You should get a list of the valid
targets in Makefile.  Of course you can also use <tab> completion.

complete make 'p@*@`egrep "'"^([^.#   ;][^:;="'"\""'"]+):"'" Makefile |
cut -d: -f1 | sed s/://g | /bin/grep -v "'"\\"'"`@'

Cheers,

-- Marc



 Sat, 25 Sep 1999 03:00:00 GMT   
 nice tcsh complete for 'make'

You should replace Makefile by [Mm]akefile

Otherwise, works nicely for me
Thanks
Bernd
--
Bernd Mohr / Research Centre Juelich, ZAM, Germany / B.M...@fz-juelich.de



 Sun, 26 Sep 1999 03:00:00 GMT   
 nice tcsh complete for 'make'

In article <Pine.GSO.3.95.970408110746.8512D-100...@bind.Stanford.EDU>,
Marc Abramowitz  <m...@bind.Stanford.EDU> wrote:
: Hi all,
:
: I just struggled a bit to come up with a nice completion for the make
: command in tcsh.  And now that I seem to have it working reasonably well,
: I figured I'd post it, have some people try it out and possibly suggest
: improvements.  Also, maybe it will inspire others to post some cool tips,
: instead of just problems...
:
: Put this all on a single line.  What looks like a bunch of spaces after
: the # sign is actually a tab character:
:
: Type 'make ' and press <Control-D>.  You should get a list of the valid
: targets in Makefile.  Of course you can also use <tab> completion.
:
: complete make 'p@*@`egrep "'"^([^.# ;][^:;="'"\""'"]+):"'" Makefile |
: cut -d: -f1 | sed s/://g | /bin/grep -v "'"\\"'"`@'

Wow, that's an awful lot of processes you're forking there.
Here's what I used, translated to zsh because that's what I use:

--CUT HERE--
maketargets() {
    reply=($(sed -n '/^[^.#^I;][^:;='\\']*:/{
s/:.*//
p

compctl -K maketargets make
--CUT HERE--

Change the ^I to an actual tab.  This does everything that your
long string of egreps, cuts, sed, and more greps does, and it does
it MUCH faster.

Figuring out how to get all those carriage returns in the sed
script into a csh-style string is your problem, though.

--Dave
--
http://www.aeon.net/~dbrown/



 Sun, 26 Sep 1999 03:00:00 GMT   
 nice tcsh complete for 'make'

How about (tcsh syntax again):

complete make 'p@*@`sed -n "/^[^.#^I;][^:;='\\']*:/s/:.*//p" [Mm]akefile`@'

No need for newlines :-)
Bernd
--
Bernd Mohr / Research Centre Juelich, ZAM, Germany / B.M...@fz-juelich.de



 Sun, 26 Sep 1999 03:00:00 GMT   
 nice tcsh complete for 'make'

dagbr...@csclub.uwaterloo.ca (Dave Brown):
 >Here's what I used, translated to zsh because that's what I use:
 >
 >--CUT HERE--
 >maketargets() {
 >    reply=($(sed -n '/^[^.#^I;][^:;='\\']*:/{
 >s/:.*//
 >p
 >}' Makefile))
 >}
 >
 >compctl -K maketargets make
 >--CUT HERE--

This is what I did for zsh:
--
make_glob()
{
        reply=()
        [ -f Makefile ] &&
                reply=(`grep '^[^#\$\.  ].*:' Makefile | cut -d: -f1`)
compctl -K make_glob make
--

I'll change the grep/cut thing into your sed-version though :)

                                                                robert



 Sun, 26 Sep 1999 03:00:00 GMT   
 
   [ 5 post ] 

Similar Threads

1. tcsh 6.04 -- builtin for nice doesn't work

2. Nice jobs aren't being nice.

3. So what's so nice about nice()?

4. Scheduling and 'nice'

5. NEwbie Question: Using 'Nice'.

6. Problems with 'nice' command

7. how the give someone 'nice' priviledge

8. Help with 'nice'

9. All proc's run NICE'd

10. 'Nice' programming in dosemu


 
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software