diff --git a/completions/bash/ss-local b/completions/bash/ss-local new file mode 100644 index 00000000..bdf12ee6 --- /dev/null +++ b/completions/bash/ss-local @@ -0,0 +1,32 @@ +_ss_local() +{ + local cur prev opts + opts='-s -b -p -k -f -t -m -c -a -n -u -U -v -h -A --fast-open --mtu --help --mptcp -i --acl -l' + cur=${COMP_WORDS[COMP_CWORD]} + prev="${COMP_WORDS[COMP_CWORD-1]}" + case "$prev" in + -c|-f|--acl) + _filedir || COMPREPLY=( $(compgen -o plusdirs -f ${cur}) ) + ;; + -s|-b|-l) + _known_hosts_real -- "${cur}" || OMPREPLY=( $(compgen -A hostname -- ${cur}) ) + ;; + -m) + COMPREPLY=( $(compgen -W "$ciphers" -- ${cur}) ) + ;; + -a) + _allowed_users || COMPREPLY=( $(compgen -u -- ${cur}) ) + ;; + -p|-k|-t|-n|--mtu) + ;; + -i) + _available_interfaces -a || true + ;; + *) + COMPREPLY+=( $(compgen -W "${opts}" -- ${cur}) ) + ;; + esac + return 0 +} + +complete -F _ss_local ss-local diff --git a/completions/bash/ss-manager b/completions/bash/ss-manager new file mode 100644 index 00000000..25679851 --- /dev/null +++ b/completions/bash/ss-manager @@ -0,0 +1,40 @@ +_ss_manager() +{ + local cur prev opts + opts='-s -b -p -k -f -t -m -c -a -n -u -U -v -h -A --mtu --help --mptcp -i -l --manager-address --executable' + cur=${COMP_WORDS[COMP_CWORD]} + prev="${COMP_WORDS[COMP_CWORD-1]}" + case "$prev" in + -c|-f|--executable) + _filedir || COMPREPLY=( $(compgen -o plusdirs -f ${cur}) ) + ;; + -s|-b|-l) + _known_hosts_real -- "${cur}" || OMPREPLY=( $(compgen -A hostname -- ${cur}) ) + ;; + -L) + compopt -o nospace + _known_hosts_real -c -- "${cur}" || OMPREPLY=( $(compgen -A hostname -S : -- ${cur}) ) + ;; + -m) + COMPREPLY=( $(compgen -W "$ciphers" -- ${cur}) ) + ;; + -a) + _allowed_users || COMPREPLY=( $(compgen -u -- ${cur}) ) + ;; + -p|-k|-t|-n|--mtu) + ;; + -i) + _available_interfaces -a || true + ;; + --manager-address) + _known_hosts_real -- "${cur}" || OMPREPLY=( $(compgen -A hostname -- ${cur}) ) + _filedir || COMPREPLY+=( $(compgen -o plusdirs -f ${cur}) ) + ;; + *) + COMPREPLY+=( $(compgen -W "${opts}" -- ${cur}) ) + ;; + esac + return 0 +} + +complete -F _ss_manager ss-manager diff --git a/completions/bash/ss-redir b/completions/bash/ss-redir new file mode 100644 index 00000000..7517b61a --- /dev/null +++ b/completions/bash/ss-redir @@ -0,0 +1,29 @@ +_ss_redir() +{ + local cur prev opts + opts='-s -b -p -k -f -t -m -c -a -n -u -U -v -h -A --mtu --help --mptcp -l' + cur=${COMP_WORDS[COMP_CWORD]} + prev="${COMP_WORDS[COMP_CWORD-1]}" + case "$prev" in + -c|-f) + _filedir || COMPREPLY=( $(compgen -o plusdirs -f ${cur}) ) + ;; + -s|-b|-l) + _known_hosts_real -- "${cur}" || OMPREPLY=( $(compgen -A hostname -- ${cur}) ) + ;; + -m) + COMPREPLY=( $(compgen -W "$ciphers" -- ${cur}) ) + ;; + -a) + _allowed_users || COMPREPLY=( $(compgen -u -- ${cur}) ) + ;; + -p|-k|-t|-n|--mtu) + ;; + *) + COMPREPLY+=( $(compgen -W "${opts}" -- ${cur}) ) + ;; + esac + return 0 +} + +complete -F _ss_redir ss-redir diff --git a/completions/bash/ss-server b/completions/bash/ss-server new file mode 100644 index 00000000..8d089c5a --- /dev/null +++ b/completions/bash/ss-server @@ -0,0 +1,37 @@ +_ss_server() +{ + local cur prev opts ciphers + opts='-s -b -p -k -f -t -m -c -a -n -u -U -v -h -A --fast-open --mtu --help --mptcp -i -6 -d --manager-address --firewall --acl' + ciphers='rc4-md5 table rc4 aes-128-cfb aes-192-cfb aes-256-cfb aes-128-ctr aes-192-ctr aes-256-ctr bf-cfb camellia-128-cfb camellia-192-cfb camellia-256-cfb cast5-cfb des-cfb idea-cfb rc2-cfb seed-cfb salsa20 chacha20 and chacha20-ietf' + COMPREPLY=() + cur=${COMP_WORDS[COMP_CWORD]} + prev="${COMP_WORDS[COMP_CWORD-1]}" + case "$prev" in + -c|-f|--acl) + _filedir || COMPREPLY=( $(compgen -o plusdirs -f ${cur}) ) + ;; + -s|-b) + _known_hosts_real -- "${cur}" || OMPREPLY=( $(compgen -A hostname -- ${cur}) ) + ;; + -m) + COMPREPLY=( $(compgen -W "$ciphers" -- ${cur}) ) + ;; + -a) + _allowed_users || COMPREPLY=( $(compgen -u -- ${cur}) ) + ;; + -p|-k|-t|-n|--mtu|-d) + ;; + --manager-address) + _known_hosts_real -- "${cur}" || OMPREPLY=( $(compgen -A hostname -- ${cur}) ) + _filedir || COMPREPLY+=( $(compgen -o plusdirs -f ${cur}) ) + ;; + -i) + _available_interfaces -a || true + ;; + *) + COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + ;; + esac +} + +complete -F _ss_server ss-server diff --git a/completions/bash/ss-tunnel b/completions/bash/ss-tunnel new file mode 100644 index 00000000..4f6bca58 --- /dev/null +++ b/completions/bash/ss-tunnel @@ -0,0 +1,37 @@ +_ss_tunnel() +{ + local cur prev opts + opts='-s -b -p -k -f -t -m -c -a -n -u -U -v -h -A --mtu --help --mptcp -i -l -L' + cur=${COMP_WORDS[COMP_CWORD]} + prev="${COMP_WORDS[COMP_CWORD-1]}" + compopt +o nospace + case "$prev" in + -c|-f) + _filedir || COMPREPLY=( $(compgen -o plusdirs -f ${cur}) ) + ;; + -s|-b|-l) + _known_hosts_real -- "${cur}" || OMPREPLY=( $(compgen -A hostname -- ${cur}) ) + ;; + -L) + compopt -o nospace + _known_hosts_real -c -- "${cur}" || OMPREPLY=( $(compgen -A hostname -S : -- ${cur}) ) + ;; + -m) + COMPREPLY=( $(compgen -W "$ciphers" -- ${cur}) ) + ;; + -a) + _allowed_users || COMPREPLY=( $(compgen -u -- ${cur}) ) + ;; + -p|-k|-t|-n|--mtu) + ;; + -i) + _available_interfaces -a || true + ;; + *) + COMPREPLY+=( $(compgen -W "${opts}" -- ${cur}) ) + ;; + esac + return 0 +} + +complete -F _ss_tunnel ss-tunnel