2021-05-25 07:10:16 +00:00
|
|
|
_innernet-server() {
|
|
|
|
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
|
2022-01-11 20:18:19 +00:00
|
|
|
"$1")
|
|
|
|
cmd="innernet__server"
|
2021-05-25 07:10:16 +00:00
|
|
|
;;
|
|
|
|
add-cidr)
|
|
|
|
cmd+="__add__cidr"
|
|
|
|
;;
|
|
|
|
add-peer)
|
|
|
|
cmd+="__add__peer"
|
|
|
|
;;
|
|
|
|
completions)
|
|
|
|
cmd+="__completions"
|
|
|
|
;;
|
|
|
|
delete-cidr)
|
|
|
|
cmd+="__delete__cidr"
|
|
|
|
;;
|
|
|
|
help)
|
|
|
|
cmd+="__help"
|
|
|
|
;;
|
|
|
|
new)
|
|
|
|
cmd+="__new"
|
|
|
|
;;
|
2021-05-31 15:23:14 +00:00
|
|
|
rename-peer)
|
|
|
|
cmd+="__rename__peer"
|
|
|
|
;;
|
2021-05-25 07:10:16 +00:00
|
|
|
serve)
|
|
|
|
cmd+="__serve"
|
|
|
|
;;
|
|
|
|
uninstall)
|
|
|
|
cmd+="__uninstall"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
case "${cmd}" in
|
2022-01-11 20:18:19 +00:00
|
|
|
innernet__server)
|
|
|
|
opts="-h -V -c -d --help --version --config-dir --data-dir --no-routing --backend --mtu new uninstall serve add-peer rename-peer add-cidr delete-cidr completions help"
|
2021-05-25 07:10:16 +00:00
|
|
|
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
|
|
|
|
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
case "${prev}" in
|
2021-12-05 17:35:18 +00:00
|
|
|
--config-dir)
|
|
|
|
COMPREPLY=($(compgen -f "${cur}"))
|
|
|
|
return 0
|
|
|
|
;;
|
2022-01-11 20:18:19 +00:00
|
|
|
-c)
|
2021-12-05 17:35:18 +00:00
|
|
|
COMPREPLY=($(compgen -f "${cur}"))
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
--data-dir)
|
|
|
|
COMPREPLY=($(compgen -f "${cur}"))
|
|
|
|
return 0
|
|
|
|
;;
|
2022-01-11 20:18:19 +00:00
|
|
|
-d)
|
2021-12-05 17:35:18 +00:00
|
|
|
COMPREPLY=($(compgen -f "${cur}"))
|
|
|
|
return 0
|
|
|
|
;;
|
2021-05-25 07:10:16 +00:00
|
|
|
--backend)
|
2022-03-15 02:15:56 +00:00
|
|
|
COMPREPLY=($(compgen -W "" -- "${cur}"))
|
2021-05-25 07:10:16 +00:00
|
|
|
return 0
|
|
|
|
;;
|
2021-06-14 14:53:02 +00:00
|
|
|
--mtu)
|
|
|
|
COMPREPLY=($(compgen -f "${cur}"))
|
|
|
|
return 0
|
|
|
|
;;
|
2021-05-25 07:10:16 +00:00
|
|
|
*)
|
|
|
|
COMPREPLY=()
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
innernet__server__add__cidr)
|
2022-01-11 20:18:19 +00:00
|
|
|
opts="-h --name --cidr --parent --yes --help <INTERFACE>"
|
2021-05-25 07:10:16 +00:00
|
|
|
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__server__add__peer)
|
2022-01-11 20:18:19 +00:00
|
|
|
opts="-h --name --ip --auto-ip --cidr --admin --yes --save-config --invite-expires --help <INTERFACE>"
|
2021-05-25 07:10:16 +00:00
|
|
|
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__server__completions)
|
2022-01-11 20:18:19 +00:00
|
|
|
opts="-h --help bash elvish fish powershell zsh"
|
2021-05-25 07:10:16 +00:00
|
|
|
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__server__delete__cidr)
|
2022-01-11 20:18:19 +00:00
|
|
|
opts="-h --name --yes --help <INTERFACE>"
|
2021-05-25 07:10:16 +00:00
|
|
|
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__server__help)
|
2022-01-18 06:19:53 +00:00
|
|
|
opts="<SUBCOMMAND>..."
|
2021-05-25 07:10:16 +00:00
|
|
|
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__server__new)
|
2022-01-11 20:18:19 +00:00
|
|
|
opts="-h --network-name --network-cidr --external-endpoint --auto-external-endpoint --listen-port --help"
|
2021-05-25 07:10:16 +00:00
|
|
|
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
|
|
|
|
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
case "${prev}" in
|
|
|
|
--network-name)
|
|
|
|
COMPREPLY=($(compgen -f "${cur}"))
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
--network-cidr)
|
|
|
|
COMPREPLY=($(compgen -f "${cur}"))
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
--external-endpoint)
|
|
|
|
COMPREPLY=($(compgen -f "${cur}"))
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
--listen-port)
|
|
|
|
COMPREPLY=($(compgen -f "${cur}"))
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
COMPREPLY=()
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
|
|
|
|
return 0
|
|
|
|
;;
|
2021-05-31 15:23:14 +00:00
|
|
|
innernet__server__rename__peer)
|
2022-01-11 20:18:19 +00:00
|
|
|
opts="-h --name --new-name --yes --help <INTERFACE>"
|
2021-05-31 15:23:14 +00:00
|
|
|
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
|
|
|
|
;;
|
2021-05-25 07:10:16 +00:00
|
|
|
innernet__server__serve)
|
2022-01-11 20:18:19 +00:00
|
|
|
opts="-h --no-routing --backend --mtu --help <INTERFACE>"
|
2021-05-25 07:10:16 +00:00
|
|
|
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
|
|
|
|
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
case "${prev}" in
|
|
|
|
--backend)
|
2022-03-15 02:15:56 +00:00
|
|
|
COMPREPLY=($(compgen -W "" -- "${cur}"))
|
2021-05-25 07:10:16 +00:00
|
|
|
return 0
|
|
|
|
;;
|
2021-06-14 14:53:02 +00:00
|
|
|
--mtu)
|
|
|
|
COMPREPLY=($(compgen -f "${cur}"))
|
|
|
|
return 0
|
|
|
|
;;
|
2021-05-25 07:10:16 +00:00
|
|
|
*)
|
|
|
|
COMPREPLY=()
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
innernet__server__uninstall)
|
2022-01-11 20:18:19 +00:00
|
|
|
opts="-h --help <INTERFACE>"
|
2021-05-25 07:10:16 +00:00
|
|
|
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
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
|
|
|
complete -F _innernet-server -o bashdefault -o default innernet-server
|