addArgument('name', InputArgument::OPTIONAL, 'User name'); $this->addArgument('host', InputArgument::OPTIONAL, 'User host'); } protected function execute(InputInterface $input, OutputInterface $output): int { $question = $this->getHelper('question'); $host = $input->getArgument('host'); if (!$name = $input->getArgument('name')) { $selectQuestion = new ChoiceQuestion('User name: ', array_map( fn($user) => $user['name'], $this->db->listUsers()) ); $name = $question->ask($input, $output, $selectQuestion); } $this->db->deleteUser($name, $host); $output->writeln(sprintf('User "%s" successfully deleted', $name)); return Command::SUCCESS; } }