fish-shell/share/functions/__fish_complete_list.fish
Kurtis Rader 11a60c8374 reformat all fish scripts
I hate doing this but I am tired of touching a fish script as part of
some change and having `make style` radically change it. Which makes
editing fish scripts more painful than it needs to be. It is time to do
a wholesale reformatting of these scripts to conform to the documented
style as implemented by the `fish_indent` program.
2016-11-27 21:27:22 -08:00

30 lines
908 B
Fish

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