增加配置文件检查和重新生成提示
This commit is contained in:
parent
e1488af75e
commit
fc5257a341
@ -50,6 +50,22 @@ create_config(){
|
|||||||
# 检查jq是否安装
|
# 检查jq是否安装
|
||||||
check_jq
|
check_jq
|
||||||
|
|
||||||
|
# 如果配置文件不存在, 创建空白配置文件
|
||||||
|
local config_file="$script_dir/../conf/config.json" # 配置文件绝对路径
|
||||||
|
if [ ! -e "$config_file" ]; then
|
||||||
|
touch "$config_file"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 如果配置文件已存在, 询问是否重新生成
|
||||||
|
if [ -e "$config_file" ]; then
|
||||||
|
local regenerate
|
||||||
|
read -p "检测到配置已存在,是否重新生成配置?(y/n): " regenerate
|
||||||
|
if [ "$regenerate" != "y" ] && [ "$regenerate" != "Y" ]; then
|
||||||
|
echo "取消重新生成配置."
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
echo "请选择配置文件类型:"
|
echo "请选择配置文件类型:"
|
||||||
echo "1. 创建reality配置"
|
echo "1. 创建reality配置"
|
||||||
echo "2. 创建xhttp_reality配置"
|
echo "2. 创建xhttp_reality配置"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user