Skip to content

CLI 命令参考

gocronx init

创建新项目。

bash
gocronx init [项目名] [flags]

参数

参数说明默认值
--moduleGo module 路径(交互式输入)
--db数据库驱动:sqlitemysqlpostgres(交互式选择)
--redis启用 Redis 支持false

示例

bash
# 交互式模式
gocronx init

# 所有参数齐全 — 无需交互
gocronx init myapp --module github.com/user/myapp --db postgres --redis

# 最简模式,使用 SQLite
gocronx init myapp --module github.com/user/myapp --db sqlite

gocronx update

更新 CLI 到最新版本。

bash
gocronx update

执行流程:

  1. 查询 GitHub Releases 获取最新版本号
  2. 如果有新版本,自动下载安装
  3. 优先使用 go install,如果没有 Go 环境则直接下载二进制文件

gocronx uninstall

从系统中卸载 gocronx。

bash
gocronx uninstall

直接删除 gocronx 二进制文件。如果安装在系统路径(如 /usr/local/bin),可能需要 sudo 权限。

版本查看

bash
gocronx --version