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

Re: killall completion



On Dec 2,  4:10am, sergio wrote:
}
} Peter Stephenson wrote:
} 
} > The trick is to treat the signal as the first argument.
} But "killall -i -KILL process" also allowed.

The trick is to understand the terminology. :-)

In "killall -i -KILL process" the "-i" is an option and the "-KILL" is
an argument.  Even though "-KILL" resembles an option because it begins
with a "-", it's really an argument.

So you should be able to modify your function as follows:

_sig_or_proc()
{
  _alternative -C set1 \
	"signals:signals:_signals -p -s" \
	"processes-names:processes-names:_processes_names"
}

_arguments -C\
     - set1 \
         ': :_sig_or_proc' \
	 '*:processes-names:_processes_names' \
         ...

(where I've left out the stuff that doesn't need changing).

However, it seems that _arguments gets confused when faced with an
argument that resembles an option, because although the above does
the right thing when asked to complete several process names, and
also does the right thing when completing after "killall -s KILL",
it fails to complete after "killall -KILL".

This looks to be yet another obscure problem with the "comparguments"
builtin.



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