/** * Execute the command. * * @param \Symfony\Component\Console\Input\InputInterface $input * @param \Symfony\Component\Console\Output\OutputInterface $output * @return void */ public function execute(InputInterface $input, OutputInterface $output) { $name = $input->getArgument('name'); $config = $input->getOption('config') ?: 'default'; $data = DataInteractor::load($config); if (!array_key_exists($name, $data)) { $output->writeln('<error>A deployment with the name ' . $name . ' doesn\'t exist!</error>'); return; } unset($data[$name]); DataInteractor::save($data, $config); $output->writeln('<info>' . $name . ' has been deleted from the ' . $config . ' config!</info>'); }
/** * Execute the command. * * @param \Symfony\Component\Console\Input\InputInterface $input * @param \Symfony\Component\Console\Output\OutputInterface $output * @return void */ public function execute(InputInterface $input, OutputInterface $output) { $name = $input->getArgument('name'); $endpoint = $input->getArgument('endpoint'); $config = $input->getOption('config') ?: 'default'; $data = DataInteractor::load($config); if (array_key_exists($name, $data)) { $output->writeln('<error>A deployment with the name ' . $name . ' already exists!</error>'); return; } $data[$name] = $endpoint; DataInteractor::save($data, $config); $output->writeln('<info>' . $name . ' has been saved to the ' . $config . ' config!</info>'); }