func main() { flag.Usage = func() { externals := lookupExternals() hadfield.Usage(append(commands, externals...), templates) } var jpeg, png, tiff bool flag.BoolVar(&jpeg, "jpg", false, "") flag.BoolVar(&jpeg, "jpeg", false, "") flag.BoolVar(&png, "png", false, "") flag.BoolVar(&tiff, "tiff", false, "") flag.BoolVar(&tiff, "tif", false, "") flag.Parse() if jpeg { utils.Output = utils.JPEG } if png { utils.Output = utils.PNG } if tiff { utils.Output = utils.TIFF } if !isRunningBuiltin(flag.Args()) { externals := lookupExternals() commands = append(commands, externals...) } hadfield.Run(commands, templates) }
func main() { flag.Parse() if *username == "" || *password == "" { log.Fatal("Both --username and --password options are required.") } client := esendex.New(*username, *password) commands := hadfield.Commands{ receivedCmd(client), sentCmd(client), messageCmd(client), accountsCmd(client), } hadfield.Run(commands, templates) }
func main() { flag.Parse() if *username == "" { *username = os.Getenv("ESENDEX_USERNAME") } if *password == "" { *password = os.Getenv("ESENDEX_PASSWORD") } if *account == "" { *account = os.Getenv("ESENDEX_ACCOUNT") } if *username == "" || *password == "" { log.Fatal(authHelp) } client := xesende.New(*username, *password) commands := hadfield.Commands{ receivedCmd(client), sentCmd(client), messageCmd(client), accountsCmd(client), } if *account == "" { commands = append(commands, receivedCmd(client), sentCmd(client)) } else { accountClient := client.Account(*account) commands = append(commands, receivedCmd(accountClient), sentCmd(accountClient), sendCmd(accountClient)) } hadfield.Run(commands, templates) }
func Example() { hadfield.Run(commands, templates) }