Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: completion for compilers (cc, gcc...) and -o
Vincent Lefevre wrote on Thu, 30 Apr 2020 10:51 +0200:
> 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);
I don't see how the existence of other ways to create .i files is
a reason not to complete .i files after -o.
> * using such files as a source may be more common.
Assuming so arguendo, how does that bear on what the completion function should do?
> 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
Offering basenames seems rather like your own personal preference, not
something that the completion system should assume everybody does.
However, refraining from offering .c files when there are no non-.c
files around is probably a good idea.
Cheers,
Daniel
Messages sorted by:
Reverse Date,
Date,
Thread,
Author