Add back App.RunAndExitOnError with deprecation message

main
Dan Buch 9 years ago
parent 02924293ff
commit 7371138edb
No known key found for this signature in database
GPG Key ID: FAEF12936DD3E3EC

@ -212,6 +212,17 @@ func (a *App) Run(arguments []string) (err error) {
return err return err
} }
// DEPRECATED: Another entry point to the cli app, takes care of passing arguments and error handling
func (a *App) RunAndExitOnError() {
fmt.Fprintln(os.Stderr,
"DEPRECATED method `*cli.App.RunAndExitOnError`. "+
"Use `*cli.App.Run` with an error type that fulfills `cli.ExitCoder`.")
if err := a.Run(os.Args); err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
}
// Invokes the subcommand given the context, parses ctx.Args() to generate command-specific flags // Invokes the subcommand given the context, parses ctx.Args() to generate command-specific flags
func (a *App) RunAsSubcommand(ctx *Context) (err error) { func (a *App) RunAsSubcommand(ctx *Context) (err error) {
// append help to commands // append help to commands

Loading…
Cancel
Save