fix(CommandProvider): use it
This commit is contained in:
parent
eb547ef962
commit
bb11cec5c7
@ -9,29 +9,15 @@ namespace Seacms\Command;
|
||||
|
||||
use Composer\Command\BaseCommand;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
/**
|
||||
* Command to lauch tests from command line accross all seacms dependencies
|
||||
*/
|
||||
|
||||
class SeacmsTest extends BaseCommand
|
||||
class Command extends BaseCommand
|
||||
{
|
||||
/**
|
||||
* @var string|null The default command name
|
||||
*/
|
||||
protected static $defaultName = 'seacms-test';
|
||||
|
||||
/**
|
||||
* overwrite default __construct to be abel to receive array
|
||||
* @param array|string|null $args
|
||||
*/
|
||||
public function __construct(string $name = null)
|
||||
{
|
||||
$name = is_string($args) ? $args : null;
|
||||
parent::__construct($name);
|
||||
}
|
||||
|
||||
/**
|
||||
* set name
|
||||
*/
|
||||
@ -44,8 +30,8 @@ use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
// the full command description shown when running the command with
|
||||
// the "--help" option
|
||||
// ->setHelp("Test seacms via command line.\n".
|
||||
// "(Only if phpunit available)\n")
|
||||
->setHelp("Test seacms via command line.\n".
|
||||
"(Only if phpunit available)\n")
|
||||
|
||||
->addOption('toto', '', InputOption::VALUE_NONE, 'Display toto text')
|
||||
->addOption('text', 't', InputOption::VALUE_REQUIRED, 'Display the text')
|
||||
@ -64,7 +50,7 @@ use Symfony\Component\Console\Output\OutputInterface;
|
||||
$output->writeln('<info>Testing seacms</info>');
|
||||
|
||||
$totoOption = $input->getOption('toto');
|
||||
$textOption = $input->getOption('test');
|
||||
$textOption = $input->getOption('text');
|
||||
|
||||
if ($totoOption){
|
||||
$output->writeln('toto');
|
25
src/commands/CommandProvider.php
Normal file
25
src/commands/CommandProvider.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* SPDX-License-Identifier: EUPL-1.2
|
||||
* Authors: see /README.md
|
||||
*/
|
||||
|
||||
namespace Seacms\Command;
|
||||
|
||||
use Composer\Plugin\Capability\CommandProvider as CommandProviderCapability;
|
||||
use Seacms\Command\Command;
|
||||
|
||||
/**
|
||||
* Provide list of commands
|
||||
*/
|
||||
|
||||
class CommandProvider implements CommandProviderCapability
|
||||
{
|
||||
public function getCommands()
|
||||
{
|
||||
return [
|
||||
new Command()
|
||||
];
|
||||
}
|
||||
}
|
@ -233,7 +233,7 @@ class Plugin extends ParentPlugin
|
||||
public function getCapabilities()
|
||||
{
|
||||
return [
|
||||
'Composer\Plugin\Capability\CommandProvider' => 'Seacms\\Command\\SeacmsTest',
|
||||
'Composer\Plugin\Capability\CommandProvider' => 'Seacms\\Command\\CommandProvider',
|
||||
];
|
||||
}
|
||||
/* === implements EventsSubscriberInterface === */
|
||||
|
Loading…
x
Reference in New Issue
Block a user