8000 feature #49810 [Scheduler] Tweak debug:scheduler command output (fabpot) · symfony/symfony@5e6ea11 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5e6ea11

Browse files
committed
feature #49810 [Scheduler] Tweak debug:scheduler command output (fabpot)
This PR was merged into the 6.3 branch. Discussion ---------- [Scheduler] Tweak debug:scheduler command output | Q | A | ------------- | --- | Branch? | 6.3 | Bug fix? | no | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tickets | n/a | License | MIT | Doc PR | n/a While trying to use the command on my test project, I realized that the output could be tweaked a little bit. cc `@kbond` Commits ------- 149798c [Scheduler] Tweak debug:scheduler command output
2 parents 50fbe01 + 149798c commit 5e6ea11

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

src/Symfony/Component/Scheduler/Command/DebugCommand.php

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
* Command to list/debug schedules.
2828
*
2929
* @author Kevin Bond <kevinbond@gmail.com>
30+
*
31+
* @experimental
3032
*/
3133
#[AsCommand(name: 'debug:scheduler', description: 'List schedules and their recurring messages')]
3234
final class DebugCommand extends Command
@@ -63,16 +65,25 @@ protected function execute(InputInterface $input, OutputInterface $output): int
6365
$io = new SymfonyStyle($input, $output);
6466
$io->title('Scheduler');
6567

66-
$names = $input->getArgument('schedule') ?: $this->scheduleNames;
68+
if (!$names = $input->getArgument('schedule') ?: $this->scheduleNames) {
69+
$io->error('No schedules found.');
70+
71+
return self::FAILURE;
72+
}
6773

6874
foreach ($names as $name) {
75+
$io->section($name);
76+
6977
/** @var ScheduleProviderInterface $schedule */
7078
$schedule = $this->schedules->get($name);
79+
if (!$messages = $schedule->getSchedule()->getRecurringMessages()) {
80+
$io->warning(sprintf('No recurring messages found for schedule "%s".', $name));
7181

72-
$io->section($name);
82+
continue;
83+
}
7384
$io->table(
7485
['Message', 'Trigger', 'Next Run'],
75-
array_map(self::renderRecurringMessage(...), $schedule->getSchedule()->getRecurringMessages())
86+
array_map(self::renderRecurringMessage(...), $messages),
7687
);
7788
}
7889

0 commit comments

Comments
 (0)
0