Open adrianandreias opened 10 years ago
Yes, this looks like a gap in feature coverage, thanks for bringing it up!
I'll need to think about whether it's worth adding but offhand I can't think of a great reason not to, unless it makes the parser that much more complicated.
:+1: It should be noted that this is related to #167 in that it involves how argument parsing is done.
@sophacles is it really? There's a lot of parsing tickets out there and I don't see how these two overlap :)
@bitprophet Just thinking in breaking corner cases, mostly when arg values and task names overlap, and the positional args are optional.. With further "reporting the problem" complications in error messages.
@task
def foo(bar, baz="default_baz"):
do_something(bar, baz)
def thing(stuff="default-stuff"):
do_something_else(stuff)
How do we handle?
# is the literal "thing" here a task name or the second arg to foo?
$ inv foo bar_arg thing "stuff_arg"
#what if I want to pass a literal thing as the second arg to foo... ala:
$ inv foo bar_arg "thing" thing
# note the quotes above don't really fix what is given to argv
# also note, it gets even wierder with required args.
# with repetition of a tasks
$ inv thing thing thing
# or even more fun if we declar the second arg to bar as positional and required...
# how do we report this error... (I'm guessing right now it's "No idea what "stuff" is!")
$ inv bar "stuff" thing "stuff" thing "stuff"
Do we need to support multiple tasks on the same invocation?
I've been using fabtools for a long time so fab foo bar
was pretty great, but invoke has already done away with the terse syntax ... inv foo && inv bar
isn't so much worse and it'd drop a lot of weirdness?
Definitely have my own use case(s) for this now, adjusting metadata accordingly :D
If I understand correctly (based on http://invoke.readthedocs.org/en/latest/api/tasks.html#invoke.tasks.task) optional AND positional arguments are not available (at the same time).
Any combination I tried I didn't manage to get both of these lines working:
I think only optional arguments that are not positional work:
Is there a way to achieve this? Or can you consider this feature request?
Thanks