Closed pawamoy closed 2 years ago
That's not far off what I had in mind. Thanks for bringing it up.
I'd like to support both named and positional arguments, in a way that translates well to different task types. For shell/cmd tasks what you describe using env variables might be a good way to do it. For script tasks passing as arg/kwargs should work too.
I hadn't thought of providing required/help keys per arg but it makes sense. For more light weight use cases it would be nice to be able to simply provide something like:
args = ["arg1", "arg2"]
or
args = {arg1 = "foo", arg2 = "bar"} # provide defaults
It should be possible to support more than one of these schemes.
As for implementation I was thinking of dynamically translating the arguments into an argparse parser for parsing and validation. Of course it would be cool to support tab completion for task arguments as well :)
I've published an initial implementation of this feature as a beta-release https://pypi.org/project/poethepoet/0.11.0b1/
It's not thoroughly tested or documented yet (see README on the feature branch ) and there are a few bits missing functionality wise but it'd be great if someone could try it out and provide feedback!
Still to do:
Named arguments released in v0.11.0.
I see in the TODO section of the README:
Could you elaborate on what it means 🙂 ?
I'm currently trying to migrate a Makefile to poe tasks, and I'd need to pass named arguments to a task:
I guess it gets a bit hard to replicate such features in a declarative way.
Maybe something like this?
...letting us do
poe do-this a=hey b=ho c=heyho
.A more verbose equivalent: