Start customising FetchTweetsCommand

This commit is contained in:
Oliver Davies 2019-01-10 14:07:11 +00:00
parent a43656e809
commit 17d4305c8a

View file

@ -17,23 +17,12 @@ class FetchTweetsCommand extends Command
{ {
$this $this
->setDescription('Add a short description for your command') ->setDescription('Add a short description for your command')
->addArgument('arg1', InputArgument::OPTIONAL, 'Argument description')
->addOption('option1', null, InputOption::VALUE_NONE, 'Option description')
; ;
} }
protected function execute(InputInterface $input, OutputInterface $output) protected function execute(InputInterface $input, OutputInterface $output)
{ {
$io = new SymfonyStyle($input, $output); $io = new SymfonyStyle($input, $output);
$arg1 = $input->getArgument('arg1');
if ($arg1) {
$io->note(sprintf('You passed an argument: %s', $arg1));
}
if ($input->getOption('option1')) {
// ...
}
$io->success('You have a new command! Now make it your own! Pass --help to see your options.'); $io->success('You have a new command! Now make it your own! Pass --help to see your options.');
} }