-
-
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
No way to map multiple args to single positional arg #54
Comments
Hi @wsascha, thanks for the feedback :) I'm afraid this feature was on my list but didn't quit make it into the initial implementation of structured arguments. I'll take this as validation that it's worth adding, and so leave this issue open. Though there are a couple of higher priority features in progress so I'm not sure when I'll get around to it. One thing that I'm not sure about though, is how multiple value arguments should be handled by tasks given that single argument values are expected to be strings which can be set as env vars or python variables within tasks. Only three solutions occur to me though none are very satisfactory:
What do you think? |
@wsascha Although looking again at your example, unless you're just using this simple example as a stand in for a more complicated use case... You don't need a named arguments at all. The following will work just fine:
|
Hey, thanks for your quick response!
The example I provided is just a minimum working example, but still: running tasks on a subset of all files often decreases runtime (e.g. running stages only on the added or changed files) or necessary for legacy code where some tasks shouldn't be run. One pragmatic idea would be to add a separate optional boolean argument parameter, maybe called "list", which sets Declaring an arg as a list, also imposes constraints on other args:
|
@wsascha Quick update: I've got a working prototype for this, but there's a bit of work left to properly test and document it. if you're interested I could make a pre-release so you can use it already. |
Hey, that's great news! You can also create a (draft) PR already and I can help review and support with tests and docs. |
@wsascha sure, happy to have some help, particularly with testing. I think the functionality I've prototypes is about right now (assuming it all works), though I'd be happy to have feedback on that too. |
This is now available in v0.14.0 |
Hey @nat-n, first of all thanks for that great tool! ❤️
I couldn't find any functionality to map more than one arg to a single arg.
Example
Maybe someone wants to have a python formatting task a la
Then, this task may be run e.g. via
poe format
poe format "."
poe format /path/to/file
poe format "/path/to/file"
poe format "/path/to/file/one /path/to/file/two"
, etc.but not
poe format /path/to/file/one /path/to/file/two
. – Note the missing"
's in the example.In my special case, I want to run tasks as pre-commit hooks using the
pre-commit
tool which, unfortunately, passes multiple filenames without the"
's.Any idea how this can be resolved? – Maybe I have also just missed something :-)
The text was updated successfully, but these errors were encountered: