5 * Contains \Drupal\Console\Command\Features\ImportCommand.
8 namespace Drupal\Console\Command\Features;
10 use Symfony\Component\Console\Input\InputArgument;
11 use Symfony\Component\Console\Input\InputOption;
12 use Symfony\Component\Console\Input\InputInterface;
13 use Symfony\Component\Console\Output\OutputInterface;
14 use Drupal\Console\Command\Shared\FeatureTrait;
15 use Drupal\Console\Core\Command\Shared\CommandTrait;
16 use Drupal\Console\Core\Style\DrupalStyle;
17 use Drupal\Console\Annotations\DrupalCommand;
18 use Symfony\Component\Console\Command\Command;
22 * extension = "features",
23 * extensionType = "module"
27 class ImportCommand extends Command
32 public function __construct()
34 parent::__construct();
37 protected function configure()
40 ->setName('features:import')
41 ->setDescription($this->trans('commands.features.import.description'))
45 InputOption::VALUE_OPTIONAL,
46 $this->trans('commands.features.import.options.bundle')
50 InputArgument::IS_ARRAY,
51 $this->trans('commands.features.import.arguments.packages')
55 protected function execute(InputInterface $input, OutputInterface $output)
57 $io = new DrupalStyle($input, $output);
59 $packages = $input->getArgument('packages');
60 $bundle = $input->getOption('bundle');
63 $packages = $this->getPackagesByBundle($bundle);
66 $this->getAssigner($bundle);
67 $this->importFeature($io, $packages);
73 protected function interact(InputInterface $input, OutputInterface $output)
75 $io = new DrupalStyle($input, $output);
77 $packages = $input->getArgument('packages');
78 $bundle = $input->getOption('bundle');
80 if (!$packages && !$bundle) {
81 // @see Drupal\Console\Command\Shared\FeatureTrait::packageQuestion
82 $bundle = $this->packageQuestion($io);
83 $input->setArgument('packages', $bundle);