Skip to content

Commit 3af96ec

Browse files
committed
add (add) command usage tips
1 parent 59bc26b commit 3af96ec

File tree

2 files changed

+22
-8
lines changed

2 files changed

+22
-8
lines changed

src/core.sh

+21-7
Original file line numberDiff line numberDiff line change
@@ -918,6 +918,7 @@ add() {
918918
is_use_host=$2
919919
is_use_uuid=$3
920920
is_use_path=$4
921+
is_add_opts="[host] [uuid] [/path]"
921922
;;
922923
vmess*)
923924
is_use_port=$2
@@ -926,6 +927,11 @@ add() {
926927
is_use_dynamic_port_start=$5
927928
is_use_dynamic_port_end=$6
928929
[[ $(grep dynamic-port <<<$is_new_protocol) ]] && is_dynamic_port=1
930+
if [[ $is_dynamic_port ]]; then
931+
is_add_opts="[port] [uuid] [type] [start_port] [end_port]"
932+
else
933+
is_add_opts="[port] [uuid] [type]"
934+
fi
929935
;;
930936
# *reality*)
931937
# is_reality=1
@@ -937,24 +943,32 @@ add() {
937943
is_use_port=$2
938944
is_use_pass=$3
939945
is_use_method=$4
946+
is_add_opts="[port] [password] [method]"
940947
;;
941948
*door)
942949
is_use_port=$2
943950
is_use_door_addr=$3
944951
is_use_door_port=$4
952+
is_add_opts="[port] [remote_addr] [remote_port]"
945953
;;
946954
socks)
947955
is_socks=1
948956
is_use_port=$2
949957
is_use_socks_user=$3
950958
is_use_socks_pass=$4
959+
is_add_opts="[port] [username] [password]"
951960
;;
952961
*http)
953962
is_use_port=$2
963+
is_add_opts="[port]"
954964
;;
955965
esac
956966

957-
[[ $1 && ! $is_change ]] && msg "\n使用协议: $is_new_protocol"
967+
[[ $1 && ! $is_change ]] && {
968+
msg "\n使用协议: $is_new_protocol"
969+
# err msg tips
970+
is_err_tips="\n\n请使用: $(_green $is_core add $1 $is_add_opts) 来添加 $is_new_protocol 配置"
971+
}
958972

959973
# remove old protocol args
960974
if [[ $is_set_new_protocol ]]; then
@@ -1003,28 +1017,28 @@ add() {
10031017

10041018
if [[ $is_use_port ]]; then
10051019
[[ ! $(is_test port ${is_use_port}) ]] && {
1006-
err "($is_use_port) 不是一个有效的端口."
1020+
err "($is_use_port) 不是一个有效的端口. $is_err_tips"
10071021
}
10081022
[[ $(is_test port_used $is_use_port) ]] && {
1009-
err "无法使用 ($is_use_port) 端口."
1023+
err "无法使用 ($is_use_port) 端口. $is_err_tips"
10101024
}
10111025
port=$is_use_port
10121026
fi
10131027
if [[ $is_use_door_port ]]; then
10141028
[[ ! $(is_test port ${is_use_door_port}) ]] && {
1015-
err "(${is_use_door_port}) 不是一个有效的目标端口."
1029+
err "(${is_use_door_port}) 不是一个有效的目标端口. $is_err_tips"
10161030
}
10171031
door_port=$is_use_door_port
10181032
fi
10191033
if [[ $is_use_uuid ]]; then
10201034
[[ ! $(is_test uuid $is_use_uuid) ]] && {
1021-
err "($is_use_uuid) 不是一个有效的 UUID."
1035+
err "($is_use_uuid) 不是一个有效的 UUID. $is_err_tips"
10221036
}
10231037
uuid=$is_use_uuid
10241038
fi
10251039
if [[ $is_use_path ]]; then
10261040
[[ ! $(is_test path $is_use_path) ]] && {
1027-
err "($is_use_path) 不是有效的路径."
1041+
err "($is_use_path) 不是有效的路径. $is_err_tips"
10281042
}
10291043
path=$is_use_path
10301044
fi
@@ -1044,7 +1058,7 @@ add() {
10441058
for v in ${is_tmp_list[@]}; do
10451059
msg "\t\t$v"
10461060
done
1047-
msg
1061+
msg "$is_err_tips\n"
10481062
exit 1
10491063
}
10501064
ss_method=$is_tmp_use_type

v2ray.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

33
args=$@
4-
is_sh_ver=v4.17
4+
is_sh_ver=v4.18
55

66
. /etc/v2ray/sh/src/init.sh

0 commit comments

Comments
 (0)