use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
-use Symfony\Component\Console\Command\Command;
-use Drupal\Console\Core\Command\Shared\CommandTrait;
-use Drupal\Console\Core\Style\DrupalStyle;
+use Drupal\Console\Core\Command\Command;
use Drupal\Console\Core\Utils\ConfigurationManager;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Yaml\Yaml;
*/
class ImportLocalCommand extends Command
{
- use CommandTrait;
-
/**
* @var string
*/
InputOption::VALUE_OPTIONAL,
$this->trans('commands.site.import.local.options.environment')
)
- ->setHelp($this->trans('commands.site.import.local.help'));
+ ->setHelp($this->trans('commands.site.import.local.help'))
+ ->setAliases(['sil']);
;
}
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
- $io = new DrupalStyle($input, $output);
-
$siteName = $input->getArgument('name');
$directory = $input->getArgument('directory');
$fileSystem = new Filesystem();
if (!$fileSystem->exists($directory)) {
- $io->error(
+ $this->getIo()->error(
sprintf(
$this->trans('commands.site.import.local.messages.error-missing'),
$directory
try {
$fileSystem->dumpFile($configFile, $dump);
} catch (\Exception $e) {
- $io->error(
+ $this->getIo()->error(
sprintf(
$this->trans('commands.site.import.local.messages.error-writing'),
$e->getMessage()
return 1;
}
- $io->success(
+ $this->getIo()->success(
sprintf(
$this->trans('commands.site.import.local.messages.imported')
)
*/
protected function interact(InputInterface $input, OutputInterface $output)
{
- $io = new DrupalStyle($input, $output);
-
$directory = $input->getArgument('directory');
if (!$directory) {
- $directory = $io->ask(
+ $directory = $this->getIo()->ask(
$this->trans('commands.site.import.local.questions.directory'),
getcwd()
);
$name = $input->getArgument('name');
if (!$name) {
- $name = $io->ask(
+ $name = $this->getIo()->ask(
$this->trans('commands.site.import.local.questions.name')
);
$input->setArgument('name', $name);