Golang: Implementing subcommands for command line applications
Golang flag package provides flag and subcommand parsing of command line arguments. Basic flags are available for most of the buildin data types (string, integer, boolean and time.Duration). To declare a string flag username with a default value root and short description, you should use the following code: package main import "flag" import "fmt" func main() { username := flag.String("user", "root", "Username for this server") flag.Parse() fmt.Printf("Your username is %q.", *username) } Once all flags are declared, call flag....