Forward args/flags down to referenced events
parent
24ccaa328d
commit
adc0bbeeb9
|
@ -201,8 +201,10 @@ simply running `composer test`:
|
||||||
> **Note:** Composer's bin-dir is pushed on top of the PATH so that binaries
|
> **Note:** Composer's bin-dir is pushed on top of the PATH so that binaries
|
||||||
> of dependencies are easily accessible as CLI commands when writing scripts.
|
> of dependencies are easily accessible as CLI commands when writing scripts.
|
||||||
|
|
||||||
Composer script can also called from other scripts, by prefixing the command name
|
## Referencing scripts
|
||||||
by `@`. For example the following syntax is valid:
|
|
||||||
|
To enable script re-use and avoid duplicates, you can call a script from another
|
||||||
|
one by prefixing the command name with `@`:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
|
|
|
@ -159,7 +159,9 @@ class EventDispatcher
|
||||||
$this->io->writeError(sprintf('> %s: %s', $event->getName(), $callable));
|
$this->io->writeError(sprintf('> %s: %s', $event->getName(), $callable));
|
||||||
}
|
}
|
||||||
$scriptName = substr($callable, 1);
|
$scriptName = substr($callable, 1);
|
||||||
$return = $this->dispatch($scriptName, new Script\Event($scriptName, $event->getComposer(), $event->getIO(), $event->isDevMode()));
|
$args = $event->getArguments();
|
||||||
|
$flags = $event->getFlags();
|
||||||
|
$return = $this->dispatch($scriptName, new Script\Event($scriptName, $event->getComposer(), $event->getIO(), $event->isDevMode(), $args, $flags));
|
||||||
} elseif ($this->isPhpScript($callable)) {
|
} elseif ($this->isPhpScript($callable)) {
|
||||||
$className = substr($callable, 0, strpos($callable, '::'));
|
$className = substr($callable, 0, strpos($callable, '::'));
|
||||||
$methodName = substr($callable, strpos($callable, '::') + 2);
|
$methodName = substr($callable, strpos($callable, '::') + 2);
|
||||||
|
|
Loading…
Reference in New Issue