Opinionated CLI starter for Golang using Viper, Cobra and Charmbracelet Fang
If you do not want to use fang just change the following lines:
func Execute() {
if err := fang.Execute(context.Background(), rootCmd); err != nil {
os.Exit(1)
}
}to this:
func Execute() {
if err := rootCmd.Execute(); err != nil {
os.Exit(1)
}
}Change package name in main.go and cmdName in cmd/root.go to whatever you want. Then run go mod tidy to update go.mod file.
go build .go run main.go