typer
typer copied to clipboard
General / custom option like -o customkey=customvalue in typer?
First Check
- [X] I added a very descriptive title to this issue.
- [X] I used the GitHub search to find a similar issue and didn't find it.
- [X] I searched the Typer documentation, with the integrated search.
- [X] I already searched in Google "How to X in Typer" and didn't find any information.
- [X] I already read and followed all the tutorial in the docs and didn't find an answer.
- [X] I already checked if it is not related to Typer but to Click.
Commit to Help
- [X] I commit to help with one of those options 👆
Example Code
I want my app to do this:
$ my-app -o a=1 -o b=2 -o passwordlogin=false
Description
I'm using my typer app to pass a json body to an API, the body should be formatted like this:
{
"module1": true
"module2": false
}
where the module names are supplied by the user.
How do I do this in typer?
Operating System
macOS
Operating System Details
No response
Typer Version
0.4.1
Python Version
Python 3.10.4
Additional Context
No response
- accept strings with a known pattern eg key<DELIM>value
- split the strings on <DELIM> into tuples
- do stuff with your list of tuples