cli
cli copied to clipboard
Missing required flags does not trigger `ExitErrHandler`
Hi everyone.
We're using the latest version (v3.3.3) of the library, and we noticed that when a command has one or more flags set as Required but they're not defined by the user, the library exits by printing the command's help without invoking any callback functions (OnUsageError or OnUsageError).
https://github.com/urfave/cli/blob/cb0fc213cc26317b82f7a9ef9352da7cc8e185e5/command_run.go#L224C1-L229C3
It's strange because the code block before and after checkAllRequiredFlags always calls deferErr = cmd.handleExitCoder(ctx, err) before returning the error, while in the case of required flags, the error is directly returned to the caller.