I'd like to be able to define a default action/message that would be run when a matching subcommand doesn't exist. Currently, users get a cryptic "No help topic for 'command'":
➜ ~ foo bar
No help topic for 'bar'
Anytime a user uses an invalid subcommand, I'd like to instead print a message and then the usage text. Is this possible today? If not, I'm happy to dive in and make a change if I could get some guidance.
Found the super handy CommandNotFound function:
app.CommandNotFound = func(c *cli.Context, command string) {
log.Err("No matching command '%s'", command)
cli.ShowAppHelp(c)
log.Die("")
}
(where log is a helper in our app)
Most helpful comment
Found the super handy
CommandNotFoundfunction:(where
logis a helper in our app)