protected function initialize(InputInterface $input, OutputInterface $output) { $container = $this->getContainer(); $configTargets = $container['config']['targets']; if (count($input->getOption('target'))) { $targets = $input->getOption('target'); } else { $output->writeln('No targets given, using all configured targets'); $targets = array_keys($configTargets); } foreach ($targets as $target) { if (!isset($configTargets[$target])) { throw new \InvalidArgumentException(sprintf('Target "%s" is not configured', $target)); } $this->targets[$target] = $configTargets[$target]; $output->writeln(sprintf('Using target %s: %s', $target, $configTargets[$target]['host'])); } parent::initialize($input, $output); }
protected function configure() { parent::configure(); $this->setName('config:vhost')->setDescription('Configure the apache vhost for this project')->addArgument('name', InputArgument::REQUIRED, 'Project name')->addArgument('dev-user', InputArgument::OPTIONAL, 'Development username')->addArgument('www-root', InputArgument::OPTIONAL, 'www root dir to use (defaults to current project/web)')->addOption('overwrite', 'o', InputOption::VALUE_NONE, 'Overwrite existing config')->addOption('fix-permissions', null, InputOption::VALUE_NONE, 'Fix file and dir permissions')->addOption('no-acl', null, InputOption::VALUE_NONE, 'Do not set ACL dir permissions'); }