2017-03-30 05:36:29 +08:00
|
|
|
function __fish_ipset_nosubcommand
|
2019-05-05 18:53:09 +08:00
|
|
|
if __fish_seen_subcommand_from create add del test destroy list save restore flush rename swap help version
|
|
|
|
return 1
|
|
|
|
end
|
|
|
|
return 0
|
2017-03-30 05:36:29 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
function __fish_ipset_needs_setname
|
2019-05-05 18:53:09 +08:00
|
|
|
if __fish_seen_subcommand_from add del test destroy list save restore flush rename swap
|
|
|
|
return 0
|
|
|
|
end
|
|
|
|
return 1
|
2017-03-30 05:36:29 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
function __fish_ipset_list_sets
|
2019-05-05 18:53:09 +08:00
|
|
|
set -l ipset_list (ipset list --name 2>/dev/null)
|
|
|
|
if not __fish_seen_subcommand_from $ipset_list
|
|
|
|
echo $ipset_list
|
|
|
|
end
|
2017-03-30 05:36:29 +08:00
|
|
|
end
|
|
|
|
|
2020-03-10 02:36:12 +08:00
|
|
|
complete -c ipset --no-files --condition __fish_ipset_nosubcommand -a create -d 'Create a set identified with SETNAME'
|
|
|
|
complete -c ipset --no-files --condition __fish_ipset_nosubcommand -a add -d 'Add a given entry to a SET'
|
|
|
|
complete -c ipset --no-files --condition __fish_ipset_nosubcommand -a del -d 'Delete an entry from a SET'
|
|
|
|
complete -c ipset --no-files --condition __fish_ipset_nosubcommand -a test -d 'Test whether an entry is in a set'
|
|
|
|
complete -c ipset --no-files --condition __fish_ipset_nosubcommand -a x -d 'Destroy the specified set or all sets'
|
|
|
|
complete -c ipset --no-files --condition __fish_ipset_nosubcommand -a destroy -d 'Destroy the specified set or all sets'
|
|
|
|
complete -c ipset --no-files --condition __fish_ipset_nosubcommand -a list -d a
|
2017-03-30 05:36:29 +08:00
|
|
|
|
2019-03-03 19:39:36 +08:00
|
|
|
complete -c ipset --no-files --condition __fish_ipset_needs_setname -a '(__fish_ipset_list_sets)'
|
2017-03-30 05:36:29 +08:00
|
|
|
|
2020-03-10 02:36:12 +08:00
|
|
|
complete -c ipset --no-files -s ! -o exist -d 'Ignore errors'
|
|
|
|
complete -c ipset --no-files -s o -o output -a 'plain save xml' -d 'Output format to the list command'
|
|
|
|
complete -c ipset --no-files -s q -o quiet -d 'Suppress any output'
|
|
|
|
complete -c ipset --no-files -s r -o resolve -d 'Enforce name lookup'
|
2017-03-30 05:36:29 +08:00
|
|
|
# complete -c ipset --no-files -s 's' -o 'sorted' -d 'Sorted output (not supported yet)'
|
2020-03-10 02:36:12 +08:00
|
|
|
complete -c ipset --no-files -s n -o name -d 'List just the names of the sets'
|
|
|
|
complete -c ipset --no-files -s t -o terse -d 'List the set names and headers'
|
|
|
|
complete -c ipset --no-files -s f -o file -d 'Filename instead of stdout'
|