Skip to content

Commit 65d8339

Browse files
committed
Fix templates not including project templates
1 parent f9c2671 commit 65d8339

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

src/Commands/CheckCommand.php

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
7979
$table = new Table($output);
8080
$table->setHeaders(['Name', 'Type', 'Source']);
8181

82-
$this->config->templates()->list()->each(function (Template $template) use ($table) {
82+
$this->templates()->each(function (Template $template) use ($table) {
8383
$table->addRow([$template->name(), $template->type(), $template->source() ?: '~']);
8484
});
8585

@@ -88,4 +88,23 @@ protected function execute(InputInterface $input, OutputInterface $output)
8888

8989
return 0;
9090
}
91+
92+
private function templates()
93+
{
94+
$items = $this->config->templates()->list();
95+
96+
if (null !== $project = $this->config->projects()->active()) {
97+
$items->merge($project->templates()->list());
98+
}
99+
100+
$items->sortUsing(function (Template $t1, Template $t2) {
101+
if ($t1->name() === $t2->name()) {
102+
return 0;
103+
}
104+
105+
return ($t1->name() < $t2->name()) ? -1 : 1;
106+
});
107+
108+
return $items;
109+
}
91110
}

0 commit comments

Comments
 (0)