fork/fish-shell

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

Fabian HomborgReindent functions to remove useless quotes9367d4ff7

master
2.0 KiB39 linesraw
1function __fish_ipset_nosubcommand
2    if __fish_seen_subcommand_from create add del test destroy list save restore flush rename swap help version
3        return 1
4    end
5    return 0
6end
7
8function __fish_ipset_needs_setname
9    if __fish_seen_subcommand_from add del test destroy list save restore flush rename swap
10        return 0
11    end
12    return 1
13end
14
15function __fish_ipset_list_sets
16    set -l ipset_list (ipset list --name 2>/dev/null)
17    if not __fish_seen_subcommand_from $ipset_list
18        echo $ipset_list
19    end
20end
21
22complete -c ipset --no-files --condition __fish_ipset_nosubcommand -a create -d 'Create a set identified with SETNAME'
23complete -c ipset --no-files --condition __fish_ipset_nosubcommand -a add -d 'Add a given entry to a SET'
24complete -c ipset --no-files --condition __fish_ipset_nosubcommand -a del -d 'Delete an entry from a SET'
25complete -c ipset --no-files --condition __fish_ipset_nosubcommand -a test -d 'Test whether an entry is in a set'
26complete -c ipset --no-files --condition __fish_ipset_nosubcommand -a x -d 'Destroy the specified set or all sets'
27complete -c ipset --no-files --condition __fish_ipset_nosubcommand -a destroy -d 'Destroy the specified set or all sets'
28complete -c ipset --no-files --condition __fish_ipset_nosubcommand -a list -d a
29
30complete -c ipset --no-files --condition __fish_ipset_needs_setname -a '(__fish_ipset_list_sets)'
31
32complete -c ipset --no-files -s ! -o exist -d 'Ignore errors'
33complete -c ipset --no-files -s o -o output -a 'plain save xml' -d 'Output format to the list command'
34complete -c ipset --no-files -s q -o quiet -d 'Suppress any output'
35complete -c ipset --no-files -s r -o resolve -d 'Enforce name lookup'
36# complete -c ipset --no-files -s 's' -o 'sorted' -d 'Sorted output (not supported yet)'
37complete -c ipset --no-files -s n -o name -d 'List just the names of the sets'
38complete -c ipset --no-files -s t -o terse -d 'List the set names and headers'
39complete -c ipset --no-files -s f -o file -d 'Filename instead of stdout'