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

Re: optional argument?



In article <200004250945.LAA03283@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
  Sven Wischnowsky <wischnow@xxxxxxxxxxxxxxxxxxxxxxx> writes:

> > Because an argument for `-o' is optional, `xxx' is an argument for the
> > option or first non-option argument.  So, the word to be completed by
> > <TAB> is first non-option argument or second non-option argument.
> > Hence `arg1' and `arg2' should be completed.  But I think this is bit
> > confused and not so useful.
> 
> Oh, did you have to say that?

I found an example.

Z(4):akr@serein% Src/zsh -f
serein% Src/zsh -f
serein% bindkey -e; fpath=($PWD/Completion/*(/)); autoload -U compinit; compinit -D; compdef _tst tst
serein% zstyle ':completion:*' group-name ''
serein% zstyle ':completion:*:messages' format %d
serein% zstyle ':completion:*:descriptions' format %d
serein% diff --context ChangeLog <TAB>
original file
CVS/            Functions/      README          aczsh.m4        config.sub*
ChangeLog       INSTALL         Src/            config.cache    configure*
ChangeLog.3.0   LICENCE         StartupFiles/   config.guess*   configure.in 
Completion/     META-FAQ        Test/           config.h        install-sh*
Config/         Makefile        Util/           config.h.in     mkinstalldirs*
Doc/            Makefile.in     acconfig.h      config.log      stamp-h 
Etc/            Misc/           aclocal.m4      config.status*  stamp-h.in 
new file
CVS/            Functions/      README          aczsh.m4        config.sub*
ChangeLog       INSTALL         Src/            config.cache    configure*
ChangeLog.3.0   LICENCE         StartupFiles/   config.guess*   configure.in 
Completion/     META-FAQ        Test/           config.h        install-sh*
Config/         Makefile        Util/           config.h.in     mkinstalldirs*
Doc/            Makefile.in     acconfig.h      config.log      stamp-h 
Etc/            Misc/           aclocal.m4      config.status*  stamp-h.in 

This is caused by optional argument for --context.  In this position,
_diff_options should completes only new files: second file set.  In
general, optional argument of _arguments always causes similar
problem, I think.  So, I think it is bit confused and not so useful.
-- 
Tanaka Akira



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