Closed clue closed 10 years ago
Multiple task support is desirable; I use it frequently with rake/capistrano.
We could adopt the unix-y idiom of using a double-dash to separate user arguments from switches/flags. This would give us an officially sanctioned mechanism for passing positional arguments:
task('dump', function($app) {
$dump = $app[0];
echo file_get_contents($dump);
});
To invoke:
phake dump -- index.php
What do you think?
Multiple task support is desirable
Turns out I was wrong. Phake does support running multiple tasks. So the provided example does work as expected and returns ab
.
The Phakefile that led me to file this issue actually invoked a pcntl_exec()
which does not return. My bad.
We could adopt the unix-y idiom of using a double-dash to separate user arguments [...]. What do you think?
Using a double dash makes perfect sense and would be a nice feature. Though I still think passing positional arguments without special syntax would still be even better. Anyway, I'll file a new ticket to keep track of this discussion.
Phakefile.php
Invoking
phake a b
:Expected Output: ab Actual Output: a
Phake seems to ignore any additional task names and thus is not quite in line with how rake/make work.
Fix should be rather easy, but I'm opening this as a reminder for the time being. Also, we might want to discuss if we could even consider this a feature.
Personally, I've (ab)used this feature as a nicer syntax to pass additional arguments to a task like this:
So running
phake dump index.php
would run thedump
task which processes any additional arguments internally. I understand that this might be an unwanted side-effect, but it certainly adds to a nicer syntax than the usualphake dump path=index.php
.