bamboo-base-go-cli 是用于初始化 bamboo-base-go-template 的命令行安装器。
它会在当前目录下创建新项目,并自动完成以下步骤:
- 克隆模板仓库
- 删除模板
.git历史 - 替换项目模块路径(
go.mod与代码引用) - 重新初始化 Git 仓库并将默认分支设置为
master - 执行
go mod tidy
- 基于
cobra的 CLI 命令结构 - 基于
bubbletea的初始化进度 TUI - 参数校验与错误提示
- 初始化流程自动化(开箱即用)
go build -o bamboo ../bamboo init github.com/XiaoLFeng/hello或直接运行:
go run . init github.com/XiaoLFeng/hello执行完成后,会在当前目录生成 hello/ 项目。
安装最新版本:
curl -fsSL https://raw.githubusercontent.com/bamboo-services/bamboo-base-go-cli/master/scripts/install.sh | bash安装指定版本:
curl -fsSL https://raw.githubusercontent.com/bamboo-services/bamboo-base-go-cli/master/scripts/install.sh | bash -s v0.0.1卸载:
curl -fsSL https://raw.githubusercontent.com/bamboo-services/bamboo-base-go-cli/master/scripts/uninstall.sh | bash安装最新版本:
iwr -useb https://raw.githubusercontent.com/bamboo-services/bamboo-base-go-cli/master/scripts/install.ps1 | iex安装指定版本:
& ([scriptblock]::Create((iwr -useb https://raw.githubusercontent.com/bamboo-services/bamboo-base-go-cli/master/scripts/install.ps1))) -Version v0.0.1卸载:
iwr -useb https://raw.githubusercontent.com/bamboo-services/bamboo-base-go-cli/master/scripts/uninstall.ps1 | iexgo run . --help
go run . init --helpbamboo init <package-name>示例:
bamboo init github.com/XiaoLFeng/hellogo test ./...
go build ./...
go fmt ./...
go vet ./...
go mod tidygithub.com/spf13/cobragithub.com/charmbracelet/bubbleteagithub.com/go-cmd/cmd
MIT