lua_cliargs icon indicating copy to clipboard operation
lua_cliargs copied to clipboard

Parsing --help needs to return something other than an error

Open alerque opened this issue 2 years ago • 1 comments

The way the --help text is parsed the message is returned in the same field as an actual parsing error, and the return code is the same as if it was a failure case. However a user actually passing --help explicitly should be considered a success.

The only way I came up with to work around this was to test the error string for :match("^Usage:") and switch gears from error handling to closing with a success status after the message. There really should be a more ergonomic way to do this. As it is most lua apps that implement CLIs with this library return a failure code when they should not.

c.f. https://github.com/orhun/halp/issues/20 c.f. https://github.com/sile-typesetter/sile/pull/1737/files c.f. https://github.com/lunarmodules/busted/pull/732 c.f. https://github.com/lunarmodules/busted/pull/733#discussion_r1429943388

alerque avatar Mar 25 '23 18:03 alerque

This issue should be resolved by https://github.com/lunarmodules/lua_cliargs/pull/78.

TheMagician23 avatar Dec 13 '23 15:12 TheMagician23