Skip to content

htekgulds/cobra-cli-starter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cobra CLI Starter

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)
	}
}

Setup

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.

Build

go build .

Dev

go run main.go

About

Opinionated CLI starter for Golang using Viper, Cobra and Charmbracelet Fang

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages