2 local cur prev opts confvars commands nets
4 cur="${COMP_WORDS[COMP_CWORD]}"
5 prev="${COMP_WORDS[COMP_CWORD-1]}"
6 opts="-c -d -D -K -n -o -L -R -U --config --no-detach --debug --net --option --mlock --logfile --pidfile --chroot --user --help --version"
7 confvars="Address AddressFamily BindToAddress BindToInterface Broadcast Cipher ClampMSS Compression ConnectTo DecrementTTL Device DeviceType Digest DirectOnly ECDSAPrivateKeyFile ECDSAPublicKey ECDSAPublicKeyFile ExperimentalProtocol Forwarding GraphDumpFile Hostnames IffOneQueue IndirectData Interface KeyExpire ListenAddress LocalDiscovery MACExpire MACLength MaxOutputBufferSize MaxTimeout Mode Name PMTU PMTUDiscovery PingInterval PingTimeout Port PriorityInheritance PrivateKeyFile ProcessPriority Proxy PublicKeyFile ReplayWindow StrictSubnets Subnet TCPOnly TunnelServer UDPRcvBuf UDPSndBuf VDEGroup VDEPort Weight"
8 commands="add connect debug del disconnect dump edit export export-all generate-ecdsa-keys generate-keys generate-rsa-keys get help import info init invite join log network pcap pid purge reload restart retry set start stop top version"
12 compopt -o dirnames 2>/dev/null
17 pushd /etc/tinc >/dev/null 2>/dev/null
19 if [[ -f "$dir/tinc.conf" ]]; then
23 popd >/dev/null 2>/dev/null
24 COMPREPLY=( $(compgen -W "${nets}" -- ${cur}) )
29 COMPREPLY=( $(compgen -W "${confvars}" -- ${cur}) )
30 if [[ ${#COMPREPLY[*]} == 1 ]] ; then
36 COMPREPLY=( $(compgen -u ${cur}) )
40 compopt -o filenames 2>/dev/null
41 COMPREPLY=( $(compgen -f ${cur}) )
44 if [[ ${cur} == -* ]] ; then
45 COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
48 if [[ $1 == "d" ]]; then
49 if [[ -z ${cur} ]] ; then
50 COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
54 COMPREPLY=( $(compgen -W "${commands}" -- ${cur}) )
57 COMPREPLY=( $(compgen -W "${confvars}" -- ${cur}) )
61 COMPREPLY=( $(compgen -W "reachable nodes edges subnets connections graph" -- ${cur}) )
66 pushd /etc/tinc >/dev/null 2>/dev/null
68 if [[ -f "$dir/tinc.conf" ]]; then
72 popd >/dev/null 2>/dev/null
73 COMPREPLY=( $(compgen -W "${nets}" -- ${cur}) )
77 if [[ -z ${cur} ]] ; then
78 COMPREPLY=( $(compgen -W "${opts} ${commands}" -- ${cur}) )
91 complete -F _tincd tincd
92 complete -F _tincctl tinc