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

Conflict between *:foo:_files and -o:bar:_files



I'm writing a completer for a program that can be called both as

  $ app input -o output

or

  $ app -o output input

For this, I've tried

  _arguments -S \
    '-o:output file:_files' \
    '*:input file:_files'

For some reason, calling the app as

  $ app input -o <PRESS-TAB-HERE>

and then using ZSH's completion system to generate alternatives
for -o, the _files completer is called twice with two different
descriptions:

  output file
  file1 file2 file3 (etc)
  input file
  file1 file2 file3 (etc)

I can "fix" this by changing the descriptions for -o and * to be the
same, e.g.

  _arguments -S \
    '-o:file:_files' \
    '*:file:_files'

I'm sure there is a better way, and I hope someone here can point me
in the right direction.

BTW: You can reproduce the bug (?) using the gcc completer:

  gcc foo.c -o <PRESS-TAB-HERE>

This results in the same kind of output as I showed above.

-- 
 Haakon



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