Provide a variable for writing output with a default of os.Stderr

This commit is contained in:
Matt Farina
2016-05-05 10:26:53 -04:00
parent 75b97d09d9
commit 2a256d4c53
4 changed files with 10 additions and 6 deletions

6
app.go
View File

@@ -228,11 +228,11 @@ func (a *App) Run(arguments []string) (err error) {
// DEPRECATED: Another entry point to the cli app, takes care of passing arguments and error handling
func (a *App) RunAndExitOnError() {
fmt.Fprintf(os.Stderr,
fmt.Fprintf(OutWriter,
"DEPRECATED cli.App.RunAndExitOnError. %s See %s\n",
contactSysadmin, runAndExitOnErrorDeprecationURL)
if err := a.Run(os.Args); err != nil {
fmt.Fprintln(os.Stderr, err)
fmt.Fprintln(OutWriter, err)
OsExiter(1)
}
}
@@ -422,7 +422,7 @@ func HandleAction(action interface{}, context *Context) (err error) {
vals := reflect.ValueOf(action).Call([]reflect.Value{reflect.ValueOf(context)})
if len(vals) == 0 {
fmt.Fprintf(os.Stderr,
fmt.Fprintf(OutWriter,
"DEPRECATED Action signature. Must be `cli.ActionFunc`. %s See %s\n",
contactSysadmin, appActionDeprecationURL)
return nil