-
-
Notifications
You must be signed in to change notification settings - Fork 814
Closed
Labels
Description
Describe the bug
I expect that my users will give my app optional arguments do contain leading double hyphens like --input. But I cannot parse optional arguments that have a single ("-") or double ("--") before the rest of the word, since such an argument does not exist.
To Reproduce
Steps to reproduce the behavior with a minimum self-contained file.
Replace each part with your own scenario:
- Create a file
main.pywith:
import typer
app = typer.Typer()
@app.command()
def goodbye(app_args: Optional[List[str]] = typer.Argument(None)):
print(app_args)
if __name__ == "__main__":
app()
- Call it with:
python main.py arg1, --arg2, val2- It outputs:
no such option: --arg2
- But I expected it to output:
('arg1,', '--arg2,', 'val2')
Expected behavior
I wanted to retain arguments with single- or double-hypens. I could find no way to escape them and interpret them literally. I expect optional arguments that do contain leading double hyphems like --input.
Screenshots
If applicable, add screenshots to help explain your problem.
Environment
- OS: [e.g. Linux / Windows / macOS] Mac OS
- Typer Version [e.g. 0.3.0], get it with: 0.3.0
python -c "import typer; print(typer.__version__)"- Python version, get it with:
python --version 3.7.3Additional context
Add any other context about the problem here.
pavinjosdev