no message

This commit is contained in:
kuaifan 2025-05-24 18:26:48 +08:00
parent f2042efdc2
commit 74ba1cc723

77
cmd
View File

@ -397,6 +397,62 @@ arg_get() {
echo $value
}
####################################################################################
####################################################################################
####################################################################################
# 显示帮助信息
show_help() {
cat << 'EOF'
DooTask 管理脚本
用法: ./cmd <命令> [参数]
📦 核心操作:
install 安装 DooTask (支持 --port <端口> --relock)
update 更新 DooTask (支持 --branch <分支> --force --local)
uninstall 卸载 DooTask
⚙️ 配置管理:
port <端口> 修改服务端口
url <地址> 修改访问地址
env <键> <值> 设置环境变量
debug [true|false] 切换调试模式
repassword [用户名] 重置数据库密码
🚀 开发构建:
serve, dev 启动开发模式
build, prod 生产环境构建
electron 构建桌面应用
🔧 服务管理:
up [服务名] 启动容器
down [服务名] 停止容器
restart [服务名] 重启容器
reup 重新构建并启动
💾 数据库操作:
mysql backup 备份数据库
mysql recovery 还原数据库
🛠️ 开发工具:
artisan <命令> 执行 Laravel Artisan 命令
composer <命令> 执行 Composer 命令
php <命令> 执行 PHP 命令
📚 其他:
doc 生成 API 文档
https 配置 HTTPS
--help, -h 显示此帮助信息
示例:
./cmd install --port 8080 安装并指定端口 8080
./cmd update --branch dev 切换到 dev 分支并更新
./cmd mysql backup 备份数据库
./cmd artisan migrate 执行数据库迁移
EOF
}
# 安装函数
run_install() {
local relock=$(arg_get relock)
@ -592,13 +648,20 @@ run_uninstall() {
####################################################################################
####################################################################################
# 优先处理帮助命令
if [[ "$1" == "help" ]] || [[ "$1" == "--help" ]] || [[ "$1" == "-h" ]] || [[ $# -eq 0 ]]; then
show_help
exit 0
fi
# 非electron命令需要检查Docker环境
if [[ "$1" != "electron" ]]; then
check_docker
env_init
fi
if [ $# -gt 0 ]; then
if [[ "$1" == "init" ]] || [[ "$1" == "install" ]]; then
# 执行命令
if [[ "$1" == "install" ]]; then
shift 1
run_install
elif [[ "$1" == "update" ]]; then
@ -628,10 +691,10 @@ if [ $# -gt 0 ]; then
elif [[ "$1" == "repassword" ]]; then
shift 1
run_exec mariadb "sh /etc/mysql/repassword.sh $@"
elif [[ "$1" == "serve" ]] || [[ "$1" == "dev" ]] || [[ "$1" == "development" ]]; then
elif [[ "$1" == "serve" ]] || [[ "$1" == "dev" ]]; then
shift 1
run_compile dev
elif [[ "$1" == "build" ]] || [[ "$1" == "prod" ]] || [[ "$1" == "production" ]]; then
elif [[ "$1" == "build" ]] || [[ "$1" == "prod" ]]; then
shift 1
run_compile prod
elif [[ "$1" == "appbuild" ]] || [[ "$1" == "buildapp" ]]; then
@ -716,9 +779,6 @@ if [ $# -gt 0 ]; then
elif [[ "$1" == "translate" ]]; then
shift 1
run_exec php "cd /var/www/language && php translate.php"
elif [[ "$1" == "test" ]]; then
shift 1
e="./vendor/bin/phpunit $@" && run_exec php "$e"
elif [[ "$1" == "restart" ]]; then
shift 1
$COMPOSE stop "$@"
@ -746,6 +806,3 @@ if [ $# -gt 0 ]; then
else
$COMPOSE "$@"
fi
else
$COMPOSE ps
fi