fork/fish-shell

git clone https://git.julia.blue/fork/fish-shell

Johannes AltmanningerMark private functions that don't need localizationa53db7256

master
1.0 KiB32 linesraw
1# localization: skip(private)
2function __fish_complete_list --argument-names div cmd prefix iprefix
3    if not set -q cmd[1]
4        echo "Usage:
5    __fish_complete_list <separator> <function> <prefix> <itemprefix>
6where:
7  separator - a symbol, separating individual entries
8  function - a function which prints a completion list to complete each entry
9  prefix - a prefix, which is printed before the list
10  itemprefix - a prefix, which is printed before each item" >/dev/stderr
11        return 1
12    end
13    set -q iprefix[1]
14    or set -l iprefix ""
15    set -q prefix[1]
16    or set -l prefix ""
17    set -l pat "$(commandline -t)"
18    if set -q __fish_stripprefix[1]
19        set pat "$(string replace -r -- "$__fish_stripprefix" "" $pat)"
20    end
21    switch $pat
22        case "*$div*"
23            for i in (string unescape -- $pat | sed "s/^\(.\+$div\)$iprefix.*\$/\1/")$iprefix(eval $cmd)
24                printf %s\n $i
25            end
26        case '*'
27            for i in $prefix$iprefix(eval $cmd)
28                printf %s\n $i
29            end
30    end
31
32end