Skip to content

Rules for positional options #311

Open
@phlptp

Description

@phlptp

Positional arguments seem to be a topic of interest and figuring out how the matching should be done in relation to unlimited positional arguments and some other modifiers is a bit ad-hoc at the moment.

Positional rules
A positional argument will match the first option not filled searched in order

  1. of Definition in the main app
  2. By order of definition in any option_groups which are themselves ordered by order of definition.
  3. positional arguments fall through to a parent if not otherwise matched.

if validate_positionals is active, then the additional consideration is that an argument must pass validation to match.

if positionals_at_end is active then positional options with the required flag will be filled with priority over non-required positionals options if insufficient arguments remain to fill any options beyond the required ones.

A question for anyone interested is are these rules sufficient or is more fine grained control necessary and if so what might that look like.

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsAdd/update documentationquestion

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions