Skip to content

Instantly share code, notes, and snippets.

@ltpitt
Created November 13, 2021 17:25
Show Gist options
  • Save ltpitt/c9724b41fe48ebf1716650d8501b3056 to your computer and use it in GitHub Desktop.
Save ltpitt/c9724b41fe48ebf1716650d8501b3056 to your computer and use it in GitHub Desktop.
How to create a cli tool in go using cobra
go get -v github.com/spf13/cobra/cobra
cobra init --pkg-name github.com/ltpitt/tri -a ltpitt
go mod init github.com/ltpitt/tri
go get github.com/spf13/cobra
go get github.com/spf13/viper
go build
tri.exe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment