A few follow-up conflict resolutions
This commit is contained in:
parent
3d67b75be7
commit
63b1a7deee
2
app.go
2
app.go
@ -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.
|
||||
}
|
||||
|
2
testdata/godoc-v2.x.txt
vendored
2
testdata/godoc-v2.x.txt
vendored
@ -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…
Reference in New Issue
Block a user