getContainer(). * * @author Tobias Schultze */ class HelloWorldCommand extends Command { /** * {@inheritdoc} */ protected function configure() { $this ->setName('acme:hello') ->setDescription('Hello World example command') ->addArgument('who', InputArgument::OPTIONAL, 'Who to greet.', 'World') ->setHelp(<<%command.name% command greets somebody or everybody: php %command.full_name% The optional argument specifies who to greet: php %command.full_name% Fabien EOF ); } /** * {@inheritdoc} */ protected function execute(InputInterface $input, OutputInterface $output) { $output->writeln(sprintf('Hello %s!', $input->getArgument('who'))); } }