-
-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add multiple option for args #70
Conversation
4b4aa9f
to
e422ff2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, sorry for the late reply, I'm currently on vacation 😅 looks good to me over all. Thanks for your efforts, really appreciated! I left two minor comments below, let me know what you think.
@@ -26,6 +26,7 @@ | |||
"positional": (bool, str), | |||
"required": bool, | |||
"type": str, | |||
"multiple": (bool, int), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if it's really necessary to have an int here. At least I don't know any use cases from tools I used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure either. Though it seemed like a low cost feature to support (because it just works with argparse), and imagined that there could be use-cases for it.
@@ -99,6 +99,29 @@ greet = "pkg:greet" | |||
type = "boolean" | |||
|
|||
|
|||
[tool.poe.tasks.multiple-value-args] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we could also add a sequence task here.
Also progress a little further on reducing test dependency on echo and env
5add810
to
515467e
Compare
7586f86
to
61f3a9f
Compare
61f3a9f
to
b8f82cb
Compare
f098f55
to
6e4d654
Compare
6e4d654
to
798688e
Compare
fff476c
to
dba4457
Compare
…lues (#70) Also improve tests for executing on windows The new `multiple` option can be added to args to make them accept multiple values. - only the last positional arg may have multiple set - multiple option defaults to false - args of type boolean may not have the multiple option set - if `multiple = true` and `required = false` then the result is `nargs="*"`, or if `required = true` then `nargs="+"` - an integer value >= 2 may also be given to specify an exact number of values are required for an arg - for script tasks the values are passed as a list, for command tasks they can be templated into the command (thus potentially passed as multiple arguments), shell tasks don't have any special support. - All tasks also get the list of values as an env var in the form of a space delimited string
WIP solution for #54 @wsascha
The new multiple option can be added to args to make them accept multiple values.
multiple = true
andrequired = false
then the result isnargs = "*"
, or ifrequired = true
thennargs = "+"
Still to test:
test_script_tasks
Also todo: