You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What I'm ultimately trying to do in my particular case is write a process runner using click. Ideally, I'd like to take the trailing end of argv as a list of strings. I'm trying to accomplish this via an argument with nargs=-1. Below is a very simple dumbed-down version that demonstrates my issue:
$ python run.py the quick brown fox
('the', 'quick', 'brown', 'fox')
$ python run.py ls -altr
Usage: run.py [OPTIONS] [ARG]...
Error: no such option: -a
Setting the type of "arg" to str didn't make a difference.
You can generalize this test to demonstrate that any argument that starts with a hyphen gives a similar error (i.e. it is interpreted as a missing option), no matter what nargs is set to. So I guess I have a practical question, and a more philosophical design question:
Am I using the right approach to accomplish my particular goal of capturing an arbitrary trailing argv of strings?
Shouldn't nargs of an option/argument win out over the processing of a new option? Suppose you have something with nargs == 2, if one of those 2 spots were to be a new option, you would have an insufficient number of parameters to the option/argument, right?
I am using Click 3.3 installed via pip/Pypi.
thanks, Eddy
The text was updated successfully, but these errors were encountered:
What I'm ultimately trying to do in my particular case is write a process runner using click. Ideally, I'd like to take the trailing end of argv as a list of strings. I'm trying to accomplish this via an argument with nargs=-1. Below is a very simple dumbed-down version that demonstrates my issue:
This code behaves as follows:
Setting the type of "arg" to str didn't make a difference.
You can generalize this test to demonstrate that any argument that starts with a hyphen gives a similar error (i.e. it is interpreted as a missing option), no matter what nargs is set to. So I guess I have a practical question, and a more philosophical design question:
I am using Click 3.3 installed via pip/Pypi.
thanks, Eddy
The text was updated successfully, but these errors were encountered: