remove showFlagError, we can use the help printer assertion to accomplish the same goal

This commit is contained in:
Lynn Cyrin
2019-08-01 19:54:57 -07:00
parent 386b379d19
commit 9438aba3b8
3 changed files with 4 additions and 20 deletions

6
app.go
View File

@@ -23,8 +23,6 @@ var (
errInvalidActionType = NewExitError("ERROR invalid Action type. "+
fmt.Sprintf("Must be `func(*Context`)` or `func(*Context) error). %s", contactSysadmin)+
fmt.Sprintf("See %s", appActionDeprecationURL), 2)
showFlagError printerFunc = fmt.Fprintln
)
// App is the main structure of a cli application. It is recommended that
@@ -235,7 +233,7 @@ func (a *App) Run(arguments []string) (err error) {
cerr := checkRequiredFlags(a.Flags, set)
if cerr != nil {
showFlagError(a.Writer, cerr)
fmt.Fprintln(a.Writer, cerr)
ShowAppHelp(context)
return cerr
}
@@ -366,7 +364,7 @@ func (a *App) RunAsSubcommand(ctx *Context) (err error) {
cerr := checkRequiredFlags(a.Flags, set)
if cerr != nil {
showFlagError(a.Writer, cerr)
fmt.Fprintln(a.Writer, cerr)
ShowSubcommandHelp(context)
return cerr
}