func main() { kingpin.Version("0.1.1") kingpin.Parse() forwardEnabled := false if *forwardhost != "" && *forwardport != "" { forwardEnabled = true } log.Println("Clenaup interval ", *cleanupInterval) serve(&MailServer{hostname: *hostname, port: *port, httpport: *webport, forwardEnabled: forwardEnabled, forwardHost: *forwardhost, forwardPort: *forwardport, expireinterval: *cleanupInterval}) }
func Run(args []string) { kingpin.CommandLine.HelpFlag.Short('h') kingpin.Version(VERSION) opFmt := &OuputFormat{JSON: *json, TSV: *tsv} switch kingpin.MustParse(cli.Parse(args[1:])) { case "servers": listServers(opFmt) case "api": apiRequest(*apiMethod, *apiPath, opFmt) } }