func init() { flag.BoolVar(&b, []string{"b"}, false, "a simple bool") flag.IntVar(&i, []string{"#integer", "-integer"}, -1, "a simple integer") flag.StringVar(&str, []string{"s", "#hidden", "-string"}, "", "a simple string") //-s -hidden and --string will work, but -hidden won't be in the usage flag.BoolVar(&h, []string{"h", "#help", "-help"}, false, "display the help") flag.Parse() }
func init() { flag.IntVar(&port, []string{"p", "-port"}, 8080, "Port to listen on for the API") flag.StringVar(&master, []string{"m", "-master"}, "localhost:5050", "Master to connect to") flag.BoolVar(&debug, []string{"D", "-debug"}, false, "") flag.StringVar(&user, []string{"u", "-user"}, "root", "User to execute tasks as") flag.StringVar(&ip, []string{"-ip"}, "", "IP address to listen on [default: autodetect]") flag.Parse() }
func init() { flag.Bool([]string{"#hp", "#-halp"}, false, "display the halp") flag.BoolVar(&b, []string{"b", "#bal", "#bol", "-bal"}, false, "a simple bool") flag.BoolVar(&b, []string{"g", "#gil"}, false, "a simple bool") flag.BoolVar(&b2, []string{"#-bool"}, false, "a simple bool") flag.IntVar(&i, []string{"-integer", "-number"}, -1, "a simple integer") flag.StringVar(&str, []string{"s", "#hidden", "-string"}, "", "a simple string") //-s -hidden and --string will work, but -hidden won't be in the usage flag.BoolVar(&h, []string{"h", "#help", "-help"}, false, "display the help") flag.StringVar(&str, []string{"mode"}, "mode1", "set the mode\nmode1: use the mode1\nmode2: use the mode2\nmode3: use the mode3") flag.Parse() }