forked from SymfonyCasts/symfony6
-
Notifications
You must be signed in to change notification settings - Fork 0
/
maker-add-output-logic.diff
28 lines (25 loc) · 1.01 KB
/
maker-add-output-logic.diff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
diff --git a/src/Command/TalkToMeCommand.php b/src/Command/TalkToMeCommand.php
index 71f62dd..6512283 100644
--- a/src/Command/TalkToMeCommand.php
+++ b/src/Command/TalkToMeCommand.php
@@ -27,17 +27,15 @@ class TalkToMeCommand extends Command
protected function execute(InputInterface $input, OutputInterface $output): int
{
$io = new SymfonyStyle($input, $output);
- $arg1 = $input->getArgument('arg1');
+ $name = $input->getArgument('name') ?: 'whoever you are';
+ $shouldYell = $input->getOption('yell');
- if ($arg1) {
- $io->note(sprintf('You passed an argument: %s', $arg1));
+ $message = sprintf('Hey %s!', $name);
+ if ($shouldYell) {
+ $message = strtoupper($message);
}
- if ($input->getOption('option1')) {
- // ...
- }
-
- $io->success('You have a new command! Now make it your own! Pass --help to see your options.');
+ $io->success($message);
return Command::SUCCESS;
}