Add _comma_separated helper function

Helper function for completing comma separated values
This commit is contained in:
Joe Bloggs 2014-03-20 14:01:33 +00:00
parent 67db8fb285
commit ab53d842a9
1 changed files with 11 additions and 0 deletions

11
src/_comma_separated Normal file
View File

@ -0,0 +1,11 @@
#autoload
# This function can be used to complete comma separated values.
# The first argument should be a description for the completion items,
# and any further args are the completion items themselves.
compset -P '*,'
local -a used vals
used=(${(s:,:)IPREFIX})
_wanted tty expl $1 compadd -S ',' -q -F used "$@[2,-1]"