argparse icon indicating copy to clipboard operation
argparse copied to clipboard

Add positional options support

Open marcrittinghaus opened this issue 2 years ago • 3 comments

Currently, positional options are not explicitly supported but just remain as unparsed arguments. This commit adds support for positional arguments so that these are treated like other options including parsing and listing in the help output.

Positional arguments can be defined as regular options but with the OPT_POSITIONAL flag:

        OPT_GROUP("Positional options"),
        OPT_INTEGER(0, "posi", &posi, "positional integer", NULL, 0, OPT_POSITIONAL),
        OPT_STRING(0, "poss", &poss, "positional string", NULL, 0, OPT_POSITIONAL),

The long name is used in error messages if the argument cannot be parsed.

This PR addresses issue: #46

marcrittinghaus avatar Dec 28 '22 14:12 marcrittinghaus

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: marcrittinghaus To complete the pull request process, please assign cofyc You can assign the PR to them by writing /assign @cofyc in a comment when ready.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment Approvers can cancel approval by writing /approve cancel in a comment

cofyc-bot avatar Dec 28 '22 14:12 cofyc-bot

@tripulse what do you think?

cofyc avatar Dec 29 '22 02:12 cofyc

Why isn't this approved yet?

GiorgosXou avatar Aug 11 '24 03:08 GiorgosXou