mchirico / zDaily

Playground to hack and test ideas with Zoe
1 stars 2 forks source link

Day 33: Cobra and Creating Project #37

Open mchirico opened 3 years ago

mchirico commented 3 years ago

video


cd yourworkdir

mkdir -p bin
mkdir -p src

export GOPATH=$(pwd)
export PATH="$(pwd)/bin:$PATH"
export GOBIN="$(pwd)/bin"

go get github.com/axw/gocov/gocov
go install github.com/axw/gocov/gocov
go get -u github.com/mchirico/date/parse
go get gopkg.in/yaml.v2

go get github.com/spf13/cobra
go get github.com/mitchellh/go-homedir
go get github.com/spf13/viper

mkdir -p mkdir -p src/github.com/mchirico-io/day33
cd src/github.com/mchirico-io/day33
cobra init --pkg-name github.com/mchirico-io/day33

export GO111MODULE=on
go mod init
tacomonkautobot[bot] commented 3 years ago

mchirico, Thanks for opening this issue!

mchirico commented 3 years ago

https://github.com/spf13/cobra#example

https://github.com/mchirico-io/day33

mchirico commented 3 years ago

You can add options, say for example, write...

cobra add write