Add RunAsSubcommand to keep API unchanged

This commit is contained in:
Naveen Gogineni
2022-10-11 16:35:54 -04:00
parent 4a109bc0ce
commit 00afca42c8
2 changed files with 6 additions and 2 deletions

6
app.go
View File

@@ -305,6 +305,12 @@ func (a *App) RunContext(ctx context.Context, arguments []string) (err error) {
return a.rootCommand.Run(cCtx, arguments...)
}
// This is a stub function to keep public API unchanged from old code
// No one should really use this. Always use a.Run to execute app
func (a *App) RunAsSubcommand(ctx *Context) (err error) {
return a.RunContext(ctx.Context, ctx.Args().Slice())
}
func (a *App) suggestFlagFromError(err error, command string) (string, error) {
flag, parseErr := flagFromError(err)
if parseErr != nil {