Skip to content

How to consume arbitrary arguments and options? #1184

Closed Answered by stinovlas
stinovlas asked this question in Questions
Discussion options

You must be logged in to vote

Sorry for this. I did search the documentation, I swear. After several hours I posted the question. An then after 10 minutes I found the solution right there in the docs: https://typer.tiangolo.com/tutorial/commands/context/?h=#configuring-the-context

import typer

app = typer.Typer()

@app.command(context_settings={"allow_extra_args": True, "ignore_unknown_options": True})
def compose(ctx: typer.Context):
    print(ctx.args)

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by stinovlas
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Question or problem
1 participant