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

completion for compilers (cc, gcc...) and -o



The -o option is currently handled by

  '-o:output file:_files -g "^*.(c|h|cc|C|cxx)(-.)"'

I wonder whether .i files (preprocessed files, e.g. for bug reports)
should be excluded too. One can choose such files for output with
"gcc -E", but:
  * in this case, one generally chooses to use the shorter ">" (or a
    pipe) rather than "-o" (gcc -E file.c > file.i);
  * using such files as a source may be more common.

Moreover, if I have a C source "myprogram.c", I generally want the
output file (program name) to be "myprogram", or if I need several
versions (e.g. because I test several options), I choose this as a
prefix, e.g. for "myprogram1", "myprogram2", "myprogram-ok", etc.
Now, when "myprogram.c" exists, but not any of the program files,
and I try to complete with

  cc -o my[TAB]

I'd like the "myprogram" to be taken into account.

Currently it seems that if there are no matches without the excluded
pattern, the completion is done on all files, that is, one gets

  cc -o myprogram.c

This does not make any sense since a .c file should normally not be
an output file. IMHO, instead of that, one should get the filename
without the filename extension:

  cc -o myprogram

-- 
Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)



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