X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=vendor%2Fdrupal%2Fconsole%2Fsrc%2FCommand%2FState%2FDeleteCommand.php;fp=vendor%2Fdrupal%2Fconsole%2Fsrc%2FCommand%2FState%2FDeleteCommand.php;h=a88cff279ce0c094b64bbee4081c7f5a511ac45f;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hp=402f878aae83507414b4b487ea0221480c19cb55;hpb=aea91e65e895364e460983b890e295aa5d5540a5;p=yaffs-website diff --git a/vendor/drupal/console/src/Command/State/DeleteCommand.php b/vendor/drupal/console/src/Command/State/DeleteCommand.php index 402f878aa..a88cff279 100644 --- a/vendor/drupal/console/src/Command/State/DeleteCommand.php +++ b/vendor/drupal/console/src/Command/State/DeleteCommand.php @@ -9,16 +9,12 @@ namespace Drupal\Console\Command\State; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Command\Command; +use Drupal\Console\Core\Command\Command; use Drupal\Core\KeyValueStore\KeyValueFactoryInterface; use Drupal\Core\State\StateInterface; -use Drupal\Console\Core\Command\Shared\CommandTrait; -use Drupal\Console\Core\Style\DrupalStyle; class DeleteCommand extends Command { - use CommandTrait; - /** * @var StateInterface */ @@ -56,7 +52,7 @@ class DeleteCommand extends Command 'name', InputArgument::OPTIONAL, $this->trans('commands.state.delete.arguments.name') - ); + )->setAliases(['std']); } /** @@ -64,11 +60,10 @@ class DeleteCommand extends Command */ protected function interact(InputInterface $input, OutputInterface $output) { - $io = new DrupalStyle($input, $output); $name = $input->getArgument('name'); if (!$name) { $names = array_keys($this->keyValue->get('state')->getAll()); - $name = $io->choiceNoList( + $name = $this->getIo()->choiceNoList( $this->trans('commands.state.delete.arguments.name'), $names ); @@ -81,16 +76,15 @@ class DeleteCommand extends Command */ protected function execute(InputInterface $input, OutputInterface $output) { - $io = new DrupalStyle($input, $output); $name = $input->getArgument('name'); if (!$name) { - $io->error($this->trans('commands.state.delete.messages.enter-name')); + $this->getIo()->error($this->trans('commands.state.delete.messages.enter-name')); return 1; } if (!$this->state->get($name)) { - $io->error( + $this->getIo()->error( sprintf( $this->trans('commands.state.delete.messages.state-not-exists'), $name @@ -103,12 +97,12 @@ class DeleteCommand extends Command try { $this->state->delete($name); } catch (\Exception $e) { - $io->error($e->getMessage()); + $this->getIo()->error($e->getMessage()); return 1; } - $io->success( + $this->getIo()->success( sprintf( $this->trans('commands.state.delete.messages.deleted'), $name