When only using command
decorator for closures, parameter parsing is strange
#1210
Answered
by
brianm78
typed-sigterm
asked this question in
Questions
-
First Check
Commit to Help
Example Code# https://codesandbox.io/p/devbox/s3kyh5?file=%2Fmain.py%3A6%2C26 Description(described in the reproduction) Operating SystemWindows Operating System DetailsNo response Typer Version0.15.3 Python Version3.13.3 Additional ContextNo response |
Beta Was this translation helpful? Give feedback.
Answered by
brianm78
May 23, 2025
Replies: 1 comment
-
That seems expected behaviour, and isn't anything to do with being in a closure. Rather, its because when you've only one command, typer doesn't create a group - it just invokes the single command. So |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
typed-sigterm
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
That seems expected behaviour, and isn't anything to do with being in a closure. Rather, its because when you've only one command, typer doesn't create a group - it just invokes the single command. So
main.py foo
isn't selecting the foo command, it's directly invoking the only defined command with argument "foo". When you add a second command (your lambda), it then creates a group, and so then "foo" is selecting the command.