Option optional value doesn't work because is_flag
is not passed to click properly
#873
-
First Check
Commit to Help
Example Codeimport typer
def main(
foo: str = typer.Option(is_flag=False, flag_value="flag", default="default"),
):
print(f"Hello {foo}")
if __name__ == "__main__":
typer.run(main) DescriptionClick support options with optional values. I'd expect Typer to work the same way, because it expose both I would expect this:
But this is what I get:
It works nice with #872. Operating SystemmacOS Operating System DetailsNo response Typer Version0.12.3 Python VersionPython 3.11.9 Additional ContextNo response |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Thanks for pointing this out! I realized it doesn't make sense to have that parameter when it's not really supported in Typer. And I consider it's better to have only the Removing the parameter was done here: #987 |
Beta Was this translation helpful? Give feedback.
Thanks for pointing this out! I realized it doesn't make sense to have that parameter when it's not really supported in Typer. And I consider it's better to have only the
boot
type annotation, and if the application code needs a string, then it can check if thebool
isTrue
orFalse
, instead of having it as part of the library.Removing the parameter was done here: #987