Skip to content

[FEATURE] Allow Arguments with alternative / custom names. #230

@feluxe

Description

@feluxe

Is your feature request related to a problem

Is your feature request related to a problem? Yes

In this example I'd like to use the name id_ internally, but for the CLI I would like to provide an alternative name id:

def user(id_: Optional[str] = typer.Argument(None)):
   ...

For Commands and Options, this is already possible using @app.command("foo") and typer.Option(..., "--foo", "-f").

For Arguments it seems there is no way of doing this... if there was it would be nice to include a section for it in the docs, similar to CLI Option Name

The solution you would like

Maybe this:

typer.Argument(None, "id")

or

typer.Argument(None, name="id")

?

Metadata

Metadata

Assignees

No one assigned

    Labels

    answeredfeatureNew feature, enhancement or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions