Example #1
0
func fatalOnError(command func(context *cli.Context) error) func(context *cli.Context) {
	return func(context *cli.Context) {
		if err := command(context); err != nil {
			log.Error(fmt.Sprintf("error: %s", err.Error()))
		}
	}
}
Example #2
0
func main() {
	app := cli.NewApp()
	app.Name = path.Base(os.Args[0])
	app.Author = "y_uuki"
	app.Email = "https://github.com/yuuki1/grabeni"
	app.Commands = commands.Commands
	app.CommandNotFound = cmdNotFound
	app.Usage = "An ops-friendly AWS ENI grabbing tool"
	app.Version = Version

	app.Flags = []cli.Flag{
		cli.BoolFlag{
			Name:  "debug, D",
			Usage: "Enable debug mode",
		},
	}

	if err := app.Run(os.Args); err != nil {
		log.Error(err.Error())
	}
}