-
Notifications
You must be signed in to change notification settings - Fork 1
/
v2ray
31 lines (28 loc) · 1.19 KB
/
v2ray
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# bash completion for v2ray/xray
function _auto_tab() {
local options_array=("start" "stop" "restart" "status" "update" "update.sh" "add" "del" "info" "port" "tls" "tfo" "stream" "iptables" "cdn" "stats" "clean" "log" "new" "rm" "-h" "-v" "help" "version")
local add_array=("wechat" "utp" "srtp" "dtls" "grpc" "wireguard" "socks" "mtproto" "ss" "vless_tcp" "vless_tls" "vless_ws" "vless_xtls" "trojan" "ss" "quic" "h2" "tcp" "tcp_host" "ws" "vless_kcp" "vless_utp" "vless_srtp" "vless_dtls" "vless_wechat" "vless_wireguard" "vless_grpc")
local log_array=("access" "a" "error" "e")
local cur prev
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
case $prev in
'v2ray')
COMPREPLY=( $(compgen -W "${options_array[*]}" -- $cur) ) ;;
'xray')
COMPREPLY=( $(compgen -W "${options_array[*]}" -- $cur) ) ;;
'add')
COMPREPLY=( $(compgen -W "${add_array[*]}" -- $cur) );;
'log')
COMPREPLY=( $(compgen -W "${log_array[*]}" -- $cur) );;
'stats')
COMPREPLY=( $(compgen -W "group user" -- $cur) );;
'iptables')
COMPREPLY=( $(compgen -W "show" -- $cur) );;
'*')
COMPREPLY=( $(compgen -d -f ${cur}) ) ;;
esac
return 0
}
complete -F _auto_tab v2ray xray