From 7371138edbce6a2ace08433e37a0a71f13c0491d Mon Sep 17 00:00:00 2001 From: Dan Buch Date: Wed, 27 Apr 2016 12:23:09 -0400 Subject: [PATCH] Add back App.RunAndExitOnError with deprecation message --- app.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/app.go b/app.go index b87ab9c..fac5fd9 100644 --- a/app.go +++ b/app.go @@ -212,6 +212,17 @@ func (a *App) Run(arguments []string) (err error) { 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 func (a *App) RunAsSubcommand(ctx *Context) (err error) { // append help to commands