Replies: 1 comment
-
I had a similar usecase where I am calling a typer app from a snakemake workflow, and sometimes the argument was missing in which case I wanted to use the app's default. I could workaround this, e.g. sending an empty string like |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
First Check
Commit to Help
Example Code
Description
I'm looking for an equivalent to python's argparse
nargs='?'
option, where:(from python's argparse docs)
The attached code is an example of the desired behavior when using
argparse
. The main feature that I'm looking is defining some constant value (or behavior) when a "bare" flag is provided, e.g:in this case, I want
foo
to contain some value, but still allowing the user to provide their own value:I hope that it makes sense...
I wasn't able to find a way to implement this using typer, would appreciate any help. thanks!
Operating System
Linux
Operating System Details
No response
Typer Version
0.15.1
Python Version
3.10.14
Additional Context
No response
Beta Was this translation helpful? Give feedback.
All reactions