reduce diff
This commit is contained in:
parent
9c299e7e8a
commit
0608059cc7
29
command.go
29
command.go
@ -262,32 +262,6 @@ func reorderArgs(args []string) []string {
|
||||
}
|
||||
}
|
||||
|
||||
// Define here so it closes over the above variables
|
||||
showErrAndHelp := func(err error) {
|
||||
fmt.Fprintln(ctx.App.Writer, err)
|
||||
fmt.Fprintln(ctx.App.Writer)
|
||||
ShowCommandHelp(ctx, c.Name)
|
||||
fmt.Fprintln(ctx.App.Writer)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
showErrAndHelp(fmt.Errorf("Incorrect Usage."))
|
||||
return err
|
||||
}
|
||||
|
||||
nerr := normalizeFlags(c.Flags, set)
|
||||
if nerr != nil {
|
||||
showErrAndHelp(nerr)
|
||||
return nerr
|
||||
}
|
||||
|
||||
cerr := checkRequiredFlags(c.Flags, set)
|
||||
if cerr != nil {
|
||||
showErrAndHelp(cerr)
|
||||
return cerr
|
||||
}
|
||||
|
||||
context := NewContext(ctx.App, set, ctx.globalSet)
|
||||
return append(flags, nonflags...)
|
||||
}
|
||||
|
||||
@ -400,9 +374,6 @@ func (c Command) startApp(ctx *Context) error {
|
||||
app.Commands[index].commandNamePath = []string{c.Name, cc.Name}
|
||||
}
|
||||
|
||||
// set the writer to the original App's writer
|
||||
app.Writer = ctx.App.Writer
|
||||
|
||||
return app.RunAsSubcommand(ctx)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user