|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Startwind\Forrest\CliCommand\Search; |
|
4
|
|
|
|
|
5
|
|
|
use Startwind\Forrest\Output\OutputHelper; |
|
6
|
|
|
use Symfony\Component\Console\Command\Command as SymfonyCommand; |
|
|
|
|
|
|
7
|
|
|
use Symfony\Component\Console\Input\InputArgument; |
|
8
|
|
|
use Symfony\Component\Console\Input\InputInterface; |
|
9
|
|
|
use Symfony\Component\Console\Input\InputOption; |
|
10
|
|
|
use Symfony\Component\Console\Output\OutputInterface; |
|
11
|
|
|
|
|
12
|
|
|
class ToolCommand extends SearchCommand |
|
13
|
|
|
{ |
|
14
|
|
|
protected static $defaultName = 'search:tool'; |
|
15
|
|
|
protected static $defaultDescription = 'Search for commands that fit the given tool.'; |
|
16
|
|
|
|
|
17
|
|
|
protected function configure(): void |
|
18
|
|
|
{ |
|
19
|
|
|
parent::configure(); |
|
20
|
|
|
|
|
21
|
|
|
$this->addArgument('tool', InputArgument::REQUIRED, 'The tool name you want to search for.'); |
|
22
|
|
|
$this->addOption('force', null, InputOption::VALUE_NONE, 'Run the command without asking for permission.'); |
|
23
|
|
|
|
|
24
|
|
|
$this->setAliases(['tool']); |
|
25
|
|
|
} |
|
26
|
|
|
|
|
27
|
|
|
protected function doExecute(InputInterface $input, OutputInterface $output): int |
|
28
|
|
|
{ |
|
29
|
|
|
OutputHelper::renderHeader($output); |
|
30
|
|
|
|
|
31
|
|
|
$this->enrichRepositories(); |
|
32
|
|
|
|
|
33
|
|
|
$tool = $input->getArgument('tool'); |
|
34
|
|
|
|
|
35
|
|
|
$this->renderInfoBox('This is a list of commands that match the given tool.'); |
|
36
|
|
|
|
|
37
|
|
|
$commands = $this->getRepositoryCollection()->searchByTools([$tool]); |
|
38
|
|
|
|
|
39
|
|
|
$toolInformation = $this->getRepositoryCollection()->getToolInformation($tool); |
|
40
|
|
|
|
|
41
|
|
|
if (count($toolInformation) > 0) { |
|
42
|
|
|
$output->writeln([' Information about "<options=bold>' . $tool . '</>":', '']); |
|
43
|
|
|
|
|
44
|
|
|
foreach ($toolInformation as $repo => $information) { |
|
45
|
|
|
$output->writeln(\Startwind\Forrest\Util\OutputHelper::indentText($information->getDescription(), 0, 100, ' | ')); |
|
46
|
|
|
if ($see = $information->getSee()) { |
|
47
|
|
|
$output->writeln(['', ' For more information visit: <href=' . $see . '>' . $see . '</>', '']); |
|
48
|
|
|
} |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
$output->writeln(''); |
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
|
|
if (empty($commands)) { |
|
55
|
|
|
$this->renderErrorBox('No commands found that match the given tool.'); |
|
56
|
|
|
return SymfonyCommand::FAILURE; |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
return $this->runFromCommands($commands); |
|
60
|
|
|
} |
|
61
|
|
|
} |
|
62
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths