
for what
- this cli generate conventional markdown and add
.github template to your project
Contributing

We welcome community contributions to this project.
Please read Contributor Guide for more information on how to get started.
请阅读有关 贡献者指南 以获取更多如何入门的信息
Features
-
markdown subcommand generate markdown badge by program language or framework, this
subcommand only output into stdout
- markdown can use git url or http url to get git info (only support github now)
- if not set
--user or --repo can input git url like https//... or git@... (v1.11.+)
- with empty
--user or --repo and empty arg0 will try to find out git info from current git project (v1.12.+)
- can cover by
arg0 to fast get badge output, event not in git managed project
--no-common-badges no badges common subcommand for this repo (default: false)
--golang add golang badges for github project
--rust add rust badges for github project
--rust-crates value crates.io name badges for this repo, if not set, use repo name
--node add node badges for github project
--npm add npm badges for github project
--docker-user --docker-repo add docker badges for github project
-
badge add badge at github project
- support badge same as
markdown subcommand, different must use in git managed project
-
template add conventional template at .github and try add badge at README.md
- support badge same as
markdown subcommand, different must use in git managed project
--coverage-folder-file coverage folder file under targetFolder, does not affect files that are not in the
template (default: false)
- conventional contributing support
--language
-
action fast add github action workflow (1.10.+), must set --ci-* to effective
--coverage-folder-file coverage folder or file under targetFolder, does not affect files that are not in the
template (default: false)
--ci-deploy-tag add sample deploy by tag
- more perfect test case coverage
usage
# install at $(GO_PATH)/bin
$ go install -v github.com/sinlov/gh-conventional-kit/cmd/gh-conventional-kit@latest
# install version v1.11.2
$ go install -v github.com/sinlov/gh-conventional-kit/cmd/gh-conventional-kit@v1.12.0
# usa as docker cli tools
$ docker run --rm sinlov/gh-conventional-kit:latest -h
# use as docker cli tools with version
$ docker run --rm sinlov/gh-conventional-kit:1.12.0 -h
- please install git before use this cli
## show commands and global options
$ gh-conventional-kit --help
## markdown tools help
$ gh-conventional-kit markdown -h
# show common badges by gitUrl 1.6.+ support
$ gh-conventional-kit markdown --golang <gitUrl>
# example
$ gh-conventional-kit markdown --golang git@github.com:sinlov/gh-conventional-kit.git
$ gh-conventional-kit markdown --golang https://github.com/sinlov/gh-conventional-kit.git
# when project is golang
$ gh-conventional-kit markdown --golang <gitUrl>
# when project is rust
$ gh-conventional-kit markdown --rust <gitUrl>
# crates name not same as repo name
$ gh-conventional-kit markdown --rust --rust-crates some-rs <gitUrl>
# when project is node
$ gh-conventional-kit markdown --node <gitUrl>
# multiple programming languages
$ gh-conventional-kit markdown --golang --node <gitUrl>
# show common badges by -u and r
$ gh-conventional-kit markdown -u [user] -r [repo]
## badge tools help
$ gh-conventional-kit badge --help
# try at your git project root path golang
$ gh-conventional-kit --dry-run badge --golang
# append at README.md head
$ gh-conventional-kit badge --golang
# if use other language like rust
$ gh-conventional-kit --dry-run badge --rust
# multiple programming languages
$ gh-conventional-kit --dry-run badge --rust --npm
# docker badges
$ gh-conventional-kit --dry-run badge --rust --docker-user [user] --docker-repo [repo]
## template tools help
$ gh-conventional-kit template --help
# try add template at .github and try add badge at README.md
$ gh-conventional-kit --dry-run template --language en-US,zh-CN
# this project is golang
$ gh-conventional-kit --dry-run template --language en-US,zh-CN --golang
# this project is rust
$ gh-conventional-kit --dry-run template --language en-US,zh-CN --rust
# crates name not same as repo name
$ gh-conventional-kit --dry-run template --language en-US,zh-CN --rust --rust-crates some-rs
# this project is node
$ gh-conventional-kit --dry-run template --language en-US,zh-CN --node
# multiple programming languages
$ gh-conventional-kit --dry-run template --language en-US,zh-CN --golang --node
# do template and add badge at README.md
$ gh-conventional-kit template --language en-US,zh-CN --golang
# coverage template .github folder files
$ gh-conventional-kit template --language en-US,zh-CN --golang --coverage-folder-file
evn
- minimum go version: go 1.19
- change
go 1.19, ^1.19, 1.19.13 to new go version
libs
dev
depends
in go mod project
# warning use private git_tools host must set
# global set for once
# add private git_tools host like github.com to evn GOPRIVATE
$ go env -w GOPRIVATE='github.com'
# use ssh proxy
# set ssh-key to use ssh as http
$ git_tools config --global url."git@github.com:".insteadOf "http://github.com/"
# or use PRIVATE-TOKEN
# set PRIVATE-TOKEN as gitlab or gitea
$ git_tools config --global http.extraheader "PRIVATE-TOKEN: {PRIVATE-TOKEN}"
# set this rep to download ssh as https use PRIVATE-TOKEN
$ git_tools config --global url."ssh://github.com/".insteadOf "https://github.com/"
# before above global settings
# test version info
$ git_tools ls-remote -q http://github.com/sinlov/gh-conventional-kit.git
# test depends see full version
$ go list -mod readonly -v -m -versions github.com/sinlov/gh-conventional-kit
# or use last version add go.mod by script
$ echo "go mod edit -require=$(go list -mod=readonly -m -versions github.com/sinlov/gh-conventional-kit | awk '{print $1 "@" $NF}')"
$ echo "go mod vendor"
local dev
# It needs to be executed after the first use or update of dependencies.
$ make init dep
$ make test testBenchmark
add main.go file and run
# run and shell help
$ make devHelp
# run at CLI_VERBOSE=true
$ make dev
# run at ordinary mode
$ make run
# check style at local
$ make style
# run ci at local
$ make ci
docker
# then test build as test/Dockerfile
$ make dockerTestRestartLatest
# clean test build
$ make dockerTestPruneLatest
# more info see
$ make helpDocker
EngineeringStructure
.
├── Dockerfile # ci docker build
├── Dockerfile.s6 # local docker build
├── Makefile # make entry
├── README.md
├── build # build output
├── cmd # command line main package
│ ├── main.go # command line entry
│ └── main_test.go # integrated test entry
├── command # command line package
│ ├── TestMain.go # common entry in unit test package
│ ├── flag.go # global flag
│ ├── global.go # global command
│ ├── global_test.go # global command unit test
│ ├── golder_data_test.go # unit test test data case
│ ├── init_test.go # unit test initialization tool
│ └── subcommand_new # subcommandPackage new
├── constant # constant package
│ └── env.go # constant environment variable
├── doc # command line tools documentation
│ └── cmd.md
├── go.mod
├── go.sum
├── package.json # command line profile information
├── resource.go # embed resource
├── utils # toolkit package
│ ├── env_kit # environment variables toolkit
│ ├── log # log toolkit
│ ├── pkgJson # package.json toolkit
│ └── urfave_cli # urfave/cli toolkit
├── vendor
└── z-MakefileUtils # make toolkit
log
package foo
func action(c *cli.Context) error {
slog.Debug("SubCommand [ new ] start") // this not show at CLI_VERBOSE=false
if c.Bool("lib") {
slog.Info("new lib mode")
}
return nil
}