2012-06-16 00:30:10 +00:00
|
|
|
function __fish_complete_list --argument div cmd prefix iprefix
|
2016-11-28 05:27:22 +00:00
|
|
|
if not set -q cmd[1]
|
|
|
|
echo "Usage:
|
2012-06-16 00:30:10 +00:00
|
|
|
__fish_complete_list <separator> <function> <prefix> <itemprefix>
|
|
|
|
where:
|
|
|
|
separator - a symbol, separating individual entries
|
|
|
|
function - a function which prints a completion list to complete each entry
|
|
|
|
prefix - a prefix, which is printed before the list
|
2016-11-28 05:27:22 +00:00
|
|
|
itemprefix - a prefix, which is printed before each item" >/dev/stderr
|
|
|
|
return 1
|
|
|
|
end
|
|
|
|
set -q iprefix[1]
|
|
|
|
or set -l iprefix ""
|
|
|
|
set -q prefix[1]
|
|
|
|
or set -l prefix ""
|
|
|
|
set -l pat (commandline -t)
|
|
|
|
#set -l pat $argv[5]
|
|
|
|
switch $pat
|
|
|
|
case "*$div*"
|
|
|
|
for i in (echo $pat | sed "s/^\(.\+$div\)$iprefix.*\$/\1/")$iprefix(eval $cmd)
|
|
|
|
echo $i
|
|
|
|
end
|
|
|
|
case '*'
|
|
|
|
for i in $prefix$iprefix(eval $cmd)
|
|
|
|
echo $i
|
|
|
|
end
|
|
|
|
end
|
2012-06-16 00:30:10 +00:00
|
|
|
|
|
|
|
|
|
|
|
end
|