diff --git a/app.go b/app.go index 34467e3..8c1ad78 100644 --- a/app.go +++ b/app.go @@ -336,12 +336,15 @@ func (app *App) prepareRun() (code int, name string) { if app.inputName == "" { Logf(VerbDebug, "input the command is not an registered: %s", name) - if stop := app.Fire(EvtAppCmdNotFound, name); stop == false { - stop = app.Fire(EvtCmdNotFound, name) - if stop == false { - app.showCommandTips(name) - } + // fire events + if stop := app.Fire(EvtAppCmdNotFound, name); stop { + return + } + if stop := app.Fire(EvtCmdNotFound, name); stop { + return } + + app.showCommandTips(name) return } diff --git a/cmd.go b/cmd.go index dd5ad89..c668a78 100644 --- a/cmd.go +++ b/cmd.go @@ -454,12 +454,10 @@ func (c *Command) innerDispatch(args []string) (err error) { // no arguments, name is not founded subcommand if !c.HasArguments() { // fire events - stop := c.Fire(EvtCmdSubNotFound, name) - if stop == true { + if stop := c.Fire(EvtCmdSubNotFound, name); stop { return } - - if stop = c.Fire(EvtCmdNotFound, name); stop == false { + if stop := c.Fire(EvtCmdNotFound, name); stop { return }