innernet/doc/innernet.completions.bash

499 lines
16 KiB
Bash

_innernet() {
local i cur prev opts cmds
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
cmd=""
opts=""
for i in ${COMP_WORDS[@]}
do
case "${i}" in
"$1")
cmd="innernet"
;;
add-association)
cmd+="__add__association"
;;
add-cidr)
cmd+="__add__cidr"
;;
add-peer)
cmd+="__add__peer"
;;
completions)
cmd+="__completions"
;;
delete-association)
cmd+="__delete__association"
;;
delete-cidr)
cmd+="__delete__cidr"
;;
disable-peer)
cmd+="__disable__peer"
;;
down)
cmd+="__down"
;;
enable-peer)
cmd+="__enable__peer"
;;
fetch)
cmd+="__fetch"
;;
help)
cmd+="__help"
;;
install)
cmd+="__install"
;;
list-associations)
cmd+="__list__associations"
;;
list-cidrs)
cmd+="__list__cidrs"
;;
override-endpoint)
cmd+="__override__endpoint"
;;
rename-peer)
cmd+="__rename__peer"
;;
set-listen-port)
cmd+="__set__listen__port"
;;
show)
cmd+="__show"
;;
uninstall)
cmd+="__uninstall"
;;
up)
cmd+="__up"
;;
*)
;;
esac
done
case "${cmd}" in
innernet)
opts="-h -V -v -c -d --help --version --verbose --config-dir --data-dir --no-routing --backend --mtu install show up fetch uninstall down add-peer rename-peer add-cidr delete-cidr list-cidrs disable-peer enable-peer add-association delete-association list-associations set-listen-port override-endpoint completions help"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
--config-dir)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
-c)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
--data-dir)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
-d)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
--backend)
COMPREPLY=($(compgen -W "kernel userspace" -- "${cur}"))
return 0
;;
--mtu)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
innernet__add__association)
opts="-h --yes --help <INTERFACE> <CIDR1> <CIDR2>"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
innernet__add__cidr)
opts="-h --name --cidr --parent --yes --help <INTERFACE>"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
--name)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
--cidr)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
--parent)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
innernet__add__peer)
opts="-h --name --ip --auto-ip --cidr --admin --yes --save-config --invite-expires --help <INTERFACE>"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
--name)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
--ip)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
--cidr)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
--admin)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
--save-config)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
--invite-expires)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
innernet__completions)
opts="-h --help bash elvish fish powershell zsh"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
innernet__delete__association)
opts="-h --yes --help <INTERFACE> <CIDR1> <CIDR2>"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
innernet__delete__cidr)
opts="-h --name --yes --help <INTERFACE>"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
--name)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
innernet__disable__peer)
opts="-h --help <INTERFACE>"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
innernet__down)
opts="-h --help <INTERFACE>"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
innernet__enable__peer)
opts="-h --help <INTERFACE>"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
innernet__fetch)
opts="-h --hosts-path --no-write-hosts --no-nat-traversal --exclude-nat-candidates --no-nat-candidates --help <INTERFACE>"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
--hosts-path)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
--exclude-nat-candidates)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
innernet__help)
opts="<SUBCOMMAND>..."
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
innernet__install)
opts="-d -h --hosts-path --no-write-hosts --name --default-name --delete-invite --no-nat-traversal --exclude-nat-candidates --no-nat-candidates --help <INVITE>"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
--hosts-path)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
--name)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
--exclude-nat-candidates)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
innernet__list__associations)
opts="-h --help <INTERFACE>"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
innernet__list__cidrs)
opts="-t -h --tree --help <INTERFACE>"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
innernet__override__endpoint)
opts="-e -u -h --endpoint --unset --yes --help <INTERFACE>"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
--endpoint)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
-e)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
innernet__rename__peer)
opts="-h --name --new-name --yes --help <INTERFACE>"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
--name)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
--new-name)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
innernet__set__listen__port)
opts="-l -u -h --listen-port --unset --yes --help <INTERFACE>"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
--listen-port)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
-l)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
innernet__show)
opts="-s -t -h --short --tree --help <INTERFACE>"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
innernet__uninstall)
opts="-h --yes --help <INTERFACE>"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
innernet__up)
opts="-d -h --daemon --interval --hosts-path --no-write-hosts --no-nat-traversal --exclude-nat-candidates --no-nat-candidates --help <INTERFACE>"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
--interval)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
--hosts-path)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
--exclude-nat-candidates)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
esac
}
complete -F _innernet -o bashdefault -o default innernet