diff --git a/src/Console/RunCommand.php b/src/Console/RunCommand.php index 85e084e..d2e3c72 100644 --- a/src/Console/RunCommand.php +++ b/src/Console/RunCommand.php @@ -105,13 +105,28 @@ protected function fire() */ protected function getTasks($container) { - $tasks = [$task = $this->argument('task')]; + return $this->buildTaskList($container, $this->argument('task')); + } + /** + * Build a list of tasks starting from a task or macro name. + * + * @param array $tasks + * @param \Laravel\Envoy\TaskContainer $container + * @param string $task + * @return array + */ + protected function buildTaskList($container, $task, $tasks = []): array + { if ($macro = $container->getMacro($task)) { - $tasks = $macro; + foreach ($macro as $task) { + $tasks = $this->buildTaskList($container, $task, $tasks); + } + + return $tasks; } - return $tasks; + return [...$tasks, $task]; } /**