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
importtyper@app.command()defhello(name: str):
"""Say hello to NAME."""typer.echo(f"Hello {name}")
@app.command()defgoodbye(name: str):
"""Say hello to NAME."""typer.echo(f"Hello {name}")
print("""This program can say hello or goodbye. To say hello to someone type hello + the name of the personTo say goodbye to someone type goodbye + the name of the person""")
command=input("What do you want to do? ")
# now let typer handle the input in command. I don't know how to do this, but I think something like this:typer.run(command) # I read the docs, so I know this won't work, but I want typer to handle the input as if it was run from the command line.
Description
Basically I want to make some kind bash shell in python with typer to parse the commands, provide help pages, etc. In the code you can see an example of what I mean. I know you can pass a command with CliRunner but that gives problems with promt() and then I still have to do some parsing myself. I think I found something similar here but I don't think this is what I want. If it is then I definitely don't know how to implement it :)
So my question is if this (processing strings and executing and everything) is possible with typer.
If not do you know a module or something else that I can use?
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
Basically I want to make some kind bash shell in python with typer to parse the commands, provide help pages, etc. In the code you can see an example of what I mean. I know you can pass a command with CliRunner but that gives problems with promt() and then I still have to do some parsing myself. I think I found something similar here but I don't think this is what I want. If it is then I definitely don't know how to implement it :)
So my question is if this (processing strings and executing and everything) is possible with typer.
If not do you know a module or something else that I can use?
Thanks in advance
Operating System
Windows
Operating System Details
No response
Typer Version
0.9.0
Python Version
3.11.0
Additional Context
No response
Beta Was this translation helpful? Give feedback.
All reactions