public function buildCommand($task, $slug = null)
{
// Build the task instance
try {
$instance = $this->buildTask($task);
} catch (TaskCompositionException $exception) {
$instance = null;
}
// Get the command name
$name = $instance ? $instance->getName() : null;
$command = $this->findQualifiedName($name, ['Rocketeer\\Console\\Commands\\%sCommand']);
// If no command found, use BaseTaskCommand or task name
if (!$command || $command === 'Closure') {
$name = is_string($task) ? $task : $name;
$command = $this->findQualifiedName($name, ['Rocketeer\\Console\\Commands\\%sCommand', 'Rocketeer\\Console\\Commands\\BaseTaskCommand']);
}
$command = new $command($instance, $slug);
$command->setLaravel($this->app);
return $command;
}