Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
alerque opened this issue Mar 25, 2023 · 1 comment · May be fixed by #78
Open

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

alerque opened this issue Mar 25, 2023 · 1 comment · May be fixed by #78

Comments

@alerque
Copy link
Member

alerque commented Mar 25, 2023

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. orhun/halp#20
c.f. https://github.com/sile-typesetter/sile/pull/1737/files
c.f. lunarmodules/busted#732
c.f. lunarmodules/busted#733 (comment)

@TheMagician23 TheMagician23 linked a pull request Dec 13, 2023 that will close this issue
@TheMagician23
Copy link

This issue should be resolved by #78.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants