Skip to content

Allow rejection of wrong number of arguments #259

@rrthomas

Description

@rrthomas

At present, it's really hard to tell whether your command was passed the number of arguments it asked for. I gave up and patched commander, and still had to check in two places (one for too many, one for zero; too few and greater than zero are checked automatically by the argument parser).

A solution would be to insist that the arguments have to match the syntax (i.e. optional arguments may be omitted, required arguments must be present, additional arguments are not allowed), and if zero arguments is not a valid number, treat that case as if "--help" were given (but preferably exit with error).

I have a patch for this which I can make into a pull request.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions