feat: 添加设置日志级别功能

This commit is contained in:
Olia Lisa
2026-07-30 10:02:41 +08:00
parent 821051a52e
commit cbedcf6094
3 changed files with 64 additions and 8 deletions
+6 -3
View File
@@ -8,6 +8,9 @@ green(){
echo -e "\033[32m$1\033[0m"
}
cyan(){
echo -e "\033[36m$1\033[0m"
}
# 动态安装软件包
install_package() {
@@ -65,7 +68,7 @@ url_encode() {
CHAR="${STR:$I:1}"
case "$CHAR" in
[a-zA-Z0-9.~_-]) ENCODED+="$CHAR" ;;
*)
*)
printf -v HEX '%02X' "'$CHAR"
ENCODED+="%$HEX"
;;
@@ -77,11 +80,11 @@ url_encode() {
# 展示当前值并询问用户新输入的值
# 用法: ask_update "提示语" "当前值(当前配置文件的值)"
# 示例:
# 示例:
# NEW_PORT=$(ask_update "请输入新的端口号" "$(jq -r '.inbounds[0].port' $CONFIG_DIR/config.json)")
ask_update() {
local PROMPT="$1" # 提示语
local CURRENT_VALUE="$2"
local CURRENT_VALUE="$2"
local INPUT
read -p "${PROMPT} [当前: ${CURRENT_VALUE}]: " INPUT