Translate a thrown Commander error (raised by cmd.exitOverride() on
missing args, invalid options, or --help) into the exit code Commander
intended. Falls back to 1 for non-Commander errors so callers can use
this from a generic catch (err) block.
Commander already writes the user-facing message before the error throws,
so callers should NOT re-emit the message themselves.
Translate a thrown Commander error (raised by
cmd.exitOverride()on missing args, invalid options, or--help) into the exit code Commander intended. Falls back to1for non-Commander errors so callers can use this from a genericcatch (err)block.Commander already writes the user-facing message before the error throws, so callers should NOT re-emit the message themselves.