blob: 99d65ef1949b1f5b0dcf62bc0ffded4d06432f28 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
function __fish_complete_list --argument div cmd prefix iprefix
if not set -q cmd[1]
echo "Usage:
__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
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
end
|