Deprecate support for `is_flag` and `flag_value` parameters
Privileged issue
- [X] I'm @tiangolo or he asked me directly to create an issue here.
Issue Content
Typer's code base currently contains is_flag and flag_value parameters like Click does. However, the current behaviour is inconsistent with Click's behaviour, and not documented.
In discussion with @tiangolo, we've come to the conclusion that these parameters are pretty confusing overall to work with. There are essentially two defaults (one set in code, and one set by flag_value) and then an option to set an arbitrary value to something that is a "flag". We feel that any behaviour obtained by this combination of parameters can probably be achieved easily with some internal logic and more straightforward (and properly typed) options/arguments.
As such, we've decided to remove these options from the code base as they're not really functional right now anyway.
Related discussions:
- https://github.com/fastapi/typer/discussions/608
- https://github.com/fastapi/typer/discussions/873
- https://github.com/fastapi/typer/pull/872
We feel that any behaviour obtained by this combination of parameters can probably be achieved easily with some internal logic and more straightforward (and properly typed) options/arguments.
Can you please show us how to do this?
I need to handle --my_arg whose default is 'hello':
app
# my_arg is None or False
app --my_arg
# my_arg = hello
app --my_arg bye
# my_arg = bye
Which I can do easily with argparse and I believe with click too.