func Main(c Command, ctx *Context, args []string) int {
	f := gnuflag.NewFlagSetWithFlagKnownAs(c.Info().Name, gnuflag.ContinueOnError, FlagAlias(c, "flag"))
	f.SetOutput(ioutil.Discard)
	c.SetFlags(f)
	if rc, done := handleCommandError(c, ctx, f.Parse(c.AllowInterspersedFlags(), args), f); done {
		return rc
	}
	// Since SuperCommands can also return gnuflag.ErrHelp errors, we need to
	// handle both those types of errors as well as "real" errors.
	if rc, done := handleCommandError(c, ctx, c.Init(f.Args()), f); done {
		return rc
	}
	if err := c.Run(ctx); err != nil {
		if IsRcPassthroughError(err) {
			return err.(*RcPassthroughError).Code
		}
		if err != ErrSilent {
			WriteError(ctx.Stderr, err)
		}
		return 1
	}
	return 0
}
// Main runs the given Command in the supplied Context with the given
// arguments, which should not include the command name. It returns a code
// suitable for passing to os.Exit.
Main runs the given Command in the supplied Context with the given
arguments, which should not include the command name. It returns a code
suitable for passing to os.Exit.
// Main runs the given Command in the supplied Context with the given // arguments which should not include the command name . It returns a code // suitable for passing to os . Exit .
func Main(c Command, ctx *Context, args []string) int {
	f := gnuflag.NewFlagSetWithFlagKnownAs(c.Info().Name, gnuflag.ContinueOnError, FlagAlias(c, "flag"))
	f.SetOutput(ioutil.Discard)
	c.SetFlags(f)
	if rc, done := handleCommandError(c, ctx, f.Parse(c.AllowInterspersedFlags(), args), f); done {
		return rc
	}
	if rc, done := handleCommandError(c, ctx, c.Init(f.Args()), f); done {
		return rc
	}
	if err := c.Run(ctx); err != nil {
		if IsRcPassthroughError(err) {
			return err.(*RcPassthroughError).Code
		}
		if err != ErrSilent {
			WriteError(ctx.Stderr, err)
		}
		return 1
	}
	return 0
}
func Main ( c Command , ctx * Context , args [ ] string ) int { f := gnuflag . NewFlagSetWithFlagKnownAs ( c . Info ( ) . Name , gnuflag . ContinueOnError , FlagAlias ( c , " " ) ) f . SetOutput ( ioutil . Discard ) c . SetFlags ( f ) if rc , done := handleCommandError ( c , ctx , f . Parse ( c . AllowInterspersedFlags ( ) , args ) , f ) ; done { return rc } if rc , done := handleCommandError ( c , ctx , c . Init ( f . Args ( ) ) , f ) ; done { return rc } if err := c . Run ( ctx ) ; err != nil { if IsRcPassthroughError ( err ) { return err . ( * RcPassthroughError ) . Code } if err != ErrSilent { WriteError ( ctx . Stderr , err ) } return 1 } return 0 }
Main runs the given Command in the supplied Context with the given
arguments, which should not include the command name.
Main runs the given Command in the supplied Context with the given arguments which should not include the command name .
// Since SuperCommands can also return gnuflag.ErrHelp errors, we need to // handle both those types of errors as well as "real" errors.