Skip to content

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

@alerque

Description

@alerque

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions