· ☕ 3 min read
cobra package cobra is command line tool that can be used to build command line tools! installation Get cobra installed go get -u usage cobra init creating a new CLI application is as easy as running cobra init cobra init --pkg-name This should create new cli application: main root main.go 1 2 3 4 5 6 7 package main import "" func main() { cmd.Execute() } root.

· ☕ 2 min read
flag package flag package provides types and functions useful for working with command line flags. installation flag package is part of standard Go library at flag usage Simple usage of flag var variable_name = flag.Type("flag_name", "initial_value", "help_message") flag.Type defines the data type of flag flag.String(), Bool(), Int(), etc. flag_name is used from command line to pass value to flag. initial_value is used to initialize flag to some default value and help_message is used to provide help information to user.