Skip to content

bamboo-services/bamboo-base-go-cli

Repository files navigation

bamboo-base-go-cli

bamboo-base-go-cli 是用于初始化 bamboo-base-go-template 的命令行安装器。

它会在当前目录下创建新项目,并自动完成以下步骤:

  • 克隆模板仓库
  • 删除模板 .git 历史
  • 替换项目模块路径(go.mod 与代码引用)
  • 重新初始化 Git 仓库并将默认分支设置为 master
  • 执行 go mod tidy

功能特性

  • 基于 cobra 的 CLI 命令结构
  • 基于 bubbletea 的初始化进度 TUI
  • 参数校验与错误提示
  • 初始化流程自动化(开箱即用)

快速开始

1. 构建

go build -o bamboo .

2. 初始化项目

./bamboo init github.com/XiaoLFeng/hello

或直接运行:

go run . init github.com/XiaoLFeng/hello

执行完成后,会在当前目录生成 hello/ 项目。

脚本安装

Linux / macOS / FreeBSD

安装最新版本:

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

Windows PowerShell

安装最新版本:

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 | iex

命令说明

查看帮助

go run . --help
go run . init --help

初始化命令

bamboo init <package-name>

示例:

bamboo init github.com/XiaoLFeng/hello

开发命令

go test ./...
go build ./...
go fmt ./...
go vet ./...
go mod tidy

依赖说明

  • github.com/spf13/cobra
  • github.com/charmbracelet/bubbletea
  • github.com/go-cmd/cmd

License

MIT

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors