diff --git a/app.go b/app.go index 4ae0c5e..e193b82 100644 --- a/app.go +++ b/app.go @@ -151,9 +151,6 @@ func (a *App) RunAsSubcommand(ctx *Context) error { } } - // add the App's CommandNotFound - a.CommandNotFound = ctx.App.CommandNotFound - // append flags if a.EnableBashCompletion { a.appendFlag(BashCompletionFlag) diff --git a/command.go b/command.go index dcc8de5..5622b38 100644 --- a/command.go +++ b/command.go @@ -118,6 +118,9 @@ func (c Command) startApp(ctx *Context) error { app.Usage = c.Usage } + // set CommandNotFound + app.CommandNotFound = ctx.App.CommandNotFound + // set the flags and commands app.Commands = c.Subcommands app.Flags = c.Flags