2021-02-14 12:42:34 +00:00
|
|
|
#!/bin/bash
|
2019-10-14 10:27:28 +00:00
|
|
|
_pivpn()
|
|
|
|
{
|
|
|
|
local cur prev opts
|
|
|
|
COMPREPLY=()
|
|
|
|
cur="${COMP_WORDS[COMP_CWORD]}"
|
|
|
|
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
2020-01-08 18:56:40 +00:00
|
|
|
dashopts="-a -c -d -l -r -h -u -up -bk"
|
|
|
|
opts="debug add clients list revoke uninstall help update backup"
|
2022-07-26 13:20:35 +00:00
|
|
|
if [ "${#COMP_WORDS[@]}" -eq 2 ]; then
|
2019-10-14 10:27:28 +00:00
|
|
|
if [[ ${cur} == -* ]] ; then
|
2021-11-02 17:30:12 +00:00
|
|
|
COMPREPLY=( "$(compgen -W "${dashopts}" -- "${cur}")" )
|
2019-10-14 10:27:28 +00:00
|
|
|
else
|
2021-11-02 17:30:12 +00:00
|
|
|
COMPREPLY=( "$(compgen -W "${opts}" -- "${cur}")" )
|
2019-10-14 10:27:28 +00:00
|
|
|
fi
|
2022-07-26 13:20:35 +00:00
|
|
|
elif [[ ( "$prev" == "add" || "$prev" == "-a" ) && "${#COMP_WORDS[@]}" -eq 3 ]]; then
|
2021-11-02 17:30:12 +00:00
|
|
|
COMPREPLY=( "$(compgen -W "nopass" -- "${cur}")" )
|
2019-10-14 10:27:28 +00:00
|
|
|
fi
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
complete -F _pivpn pivpn
|