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

Re: killall completion



Bart Schaefer wrote:

It offers both signals and process names when completing after "killall"
with nothing else on the line yet.
But it's unnecessary. -SIGNAL ( and also -SIGSIGNAL and -number ) should be processed as -s SIGNAL.

And this code doesn't offers both signals and process...

#compdef killall

local curcontext="$curcontext" line state ret=1
local all
all=$( (( ${funcstack[(eI)$_comps[sudo]]} || ${(%):-%(!.1.0)} )) && echo -n a )

_processes_names()
{
compadd "$expl[@]" ${${(f)"$(_call_program processes-names ps ${all}xho comm 2> /dev/null)"}:#ps}
}
_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' \
        ':signals:_signals -p -s' && ret=0

return ret

--
sergio.



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