fork/fish-shell

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

Johannes AltmanningerMerge branch 'completions-to-use-expanded-tokens'a9618477e

master
1.6 KiB42 linesraw
1function __fish_complete_abook_formats --description 'Complete abook formats'
2    set -l format
3    abook --formats | while read -l x
4        switch $x
5            case "input formats:"
6                set format input
7            case "output formats:"
8                set format output
9            case "query-compatible output formats:"
10                set format ignore
11        end
12        set --append "$format" (string replace -rf '\t(.*\t.*)' '$1' -- $x)
13    end
14    switch $argv[1]
15        case in
16            for l in $input
17                echo $l
18            end
19        case out
20            for l in $output
21                echo $l
22            end
23        case '*'
24            return 1
25    end
26end
27
28complete -c abook -s h -d 'Show usage'
29complete -c abook -s C -l config -d 'Use an alternative configuration file' -r
30complete -c abook -l datafile -d 'Use an alternative addressbook file' -r
31complete -c abook -l mutt-query -d 'Make a query for mutt' -x
32complete -c abook -l add-email -d 'Read email message from stdin and add the sender'
33complete -c abook -l add-email-quiet -d 'Same as --add-email. Without confirmation'
34complete -c abook -l convert -d 'Convert address book files'
35
36set -l convert 'contains -- --convert (commandline -px)'
37complete -c abook -l informat -d 'Input file format' -xa '(__fish_complete_abook_formats in)' -n $convert
38complete -c abook -l outformat -d 'Output file format' -xa '(__fish_complete_abook_formats out)' -n $convert
39complete -c abook -l infile -d 'Input file (default: stdin)' -r -n $convert
40complete -c abook -l outfile -d 'Output file (default: stdout)' -r -n $convert
41
42complete -c abook -l formats -d 'Print available formats'