Skip to content

Improve help for types that have choices #55

@multimeric

Description

@multimeric

For example, if you have a Pydantic model with an enum type, the flag will be displayed as:

  --skew SKEW           (type:DeskewDirection default:DeskewDirection.Y)

Similarly, if you use a Literal:

class Model(BaseModel):
    bar: Literal["x", "y"]

you get:

  --bar BAR             (type:typing.Literal['x', 'y'] required=True)

In all of these cases, we have a readily accessible list of options, and it would be much more user friendly to provide these in the help.

Compare this to argparse's choices, which are printed as:

usage: game.py [-h] {rock,paper,scissors}

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