示例#1
0
文件: commands.go 项目: yuuki/droot
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(err)
		}
	}
}
示例#2
0
文件: droot.go 项目: yuuki/droot
func main() {
	app := cli.NewApp()
	app.Name = path.Base(os.Args[0])
	app.Author = "y_uuki"
	app.Email = "https://github.com/yuuki/droot"
	app.Commands = commands.Commands
	app.CommandNotFound = cmdNotFound
	app.Usage = "droot is a super-easy container with chroot without docker."
	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)
	}
}