You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I used the GitHub search to find a similar question and didn't find it.
I searched the Typer documentation, with the integrated search.
I already searched in Google "How to X in Typer" and didn't find any information.
I already read and followed all the tutorial in the docs and didn't find an answer.
I already checked if it is not related to Typer but to Click.
Commit to Help
I commit to help with one of those options 👆
Example Code
importtyperapp=typer.Typer()
update_app=typer.Typer()
@update_app.command()defpassword(password: str):
# update passwordpass@app.command()defuser(email: str):
# get user emailpassapp.add_typer(update_app, name="update")
if__name__=="__main__":
app()
Description
I think that the pattern I want to achieve is pretty straightforward. I would like to be able to define subcommand to app, but force user to pass some argument before subcommand. In this example I want to have user to act as a selector of some particular user before I follow with subcommands. So my expected behavior is to be able to do: python3 main.py user "test@test.com" update password "qwerty"
Currently it just show "update" as one of the commands of the main program.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
First Check
Commit to Help
Example Code
Description
I think that the pattern I want to achieve is pretty straightforward. I would like to be able to define subcommand to
app
, but force user to pass some argument before subcommand. In this example I want to haveuser
to act as a selector of some particular user before I follow with subcommands. So my expected behavior is to be able to do:python3 main.py user "test@test.com" update password "qwerty"
Currently it just show "update" as one of the commands of the main program.
Operating System
macOS
Operating System Details
No response
Typer Version
0.9.0
Python Version
3.11.6
Additional Context
No response
Beta Was this translation helpful? Give feedback.
All reactions