Skip to content

Specify multiple arguments (i.e. nargs option) #10

@torrance

Description

@torrance

It is fairly typical for some program options to accept multiple arguments, e.g. --imgsize 2000 3000, or for some options to accept an unknown number of arguments, such as positional arguments, e.g. filename1 [filename2...]

Python's parseargs handles this with an nargs parameter, which can either be an Integer, a '+' (meaning at least one but possibly more), '?' (meaning one or the default), '*' (any number of arguments, including none). See: https://docs.python.org/3/library/argparse.html#nargs

ArgMacros only has a much more limited version of this in 'positionalleftover', which is awkward as it requires manually gathering additional positional arguments and doesn't work for any other options.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions