示例#1
0
文件: cli.go 项目: Byron/godi
// Check common args and init a command with them.
// Further init and checking should be done in specialized function
func CheckCommonFlagsAndInit(cmd api.Runner, c *cli.Context) error {
	nr, level, filters, err := CheckCommonFlags(c)
	if err != nil {
		return err
	}

	return cmd.Init(nr, nr, c.Args(), level, filters)
}
示例#2
0
文件: cli.go 项目: Byron/godi
// Runs a standard runner from within the cli, dealing with errors accoringly
func RunAction(cmd api.Runner, c *cli.Context) {
	handler := MakeLogHandler(cmd.LogLevel())
	err := api.StartEngine(cmd, handler)
	nerr := CliFinishApp(c)
	if err != nil || nerr != nil {
		os.Exit(1)
	}
}