[QUESTION] is there any way to add fallback function if no command name has been entered? #339
Closed
7 tasks done
Labels
question
Question or problem
First Check
Commit to Help
Example Code
Description
Forgive me if this question seems simple or has been answered before,
I would like to be able to run my cli with a command name which would correspond to testing the product of choice, but would also like the freedom of inputting no command and letting me choose the product.
I have a nested cli with "main.add_typer(test_cli, name='test')"
For example, if my code above was called test_cli.py, I would like to run
"python3 main.py test toy" -- this would test the toy product
but if I run
"python3 main.py test" -- this would ask me to choose which product to test and would then run the corresponding test function as if it was run from the command line (so all the Options/Arguments will be asked)
I have tried using name == "test_cli" but that runs with or without a command.
Is this possible?
Operating System
Linux
Operating System Details
No response
Typer Version
0.4.0
Python Version
3.8
Additional Context
No response
The text was updated successfully, but these errors were encountered: