A few follow-up conflict resolutions

main
Dan Buch 2 years ago
parent 3d67b75be7
commit 63b1a7deee
Signed by: meatballhat
GPG Key ID: A12F782281063434

@ -391,7 +391,7 @@ func (a *App) RunAsSubcommand(ctx *Context) (err error) {
}
_, _ = fmt.Fprintf(a.Writer, "%s %s\n\n", "Incorrect Usage.", err.Error())
if a.Suggest {
if suggestion, err := a.suggestFlagFromError(err, context.Command.Name); err == nil {
if suggestion, err := a.suggestFlagFromError(err, cCtx.Command.Name); err == nil {
fmt.Fprintf(a.Writer, suggestion)
}
}

@ -121,7 +121,7 @@ func (c *Command) Run(ctx *Context) (err error) {
_, _ = fmt.Fprintln(cCtx.App.Writer)
if ctx.App.Suggest {
if suggestion, err := ctx.App.suggestFlagFromError(err, c.Name); err == nil {
fmt.Fprintf(context.App.Writer, suggestion)
fmt.Fprintf(cCtx.App.Writer, suggestion)
}
}
_ = ShowCommandHelp(cCtx, c.Name)

@ -305,6 +305,8 @@ type App struct {
// single-character bool arguments into one
// i.e. foobar -o -v -> foobar -ov
UseShortOptionHandling bool
// Enable suggestions for commands and flags
Suggest bool
// Has unexported fields.
}

@ -305,6 +305,8 @@ type App struct {
// single-character bool arguments into one
// i.e. foobar -o -v -> foobar -ov
UseShortOptionHandling bool
// Enable suggestions for commands and flags
Suggest bool
// Has unexported fields.
}

Loading…
Cancel
Save