Skip to content

Commit

Permalink
fix(Background): Show comment about limit at end and conditionally
Browse files Browse the repository at this point in the history
* Only print the comment when job list is truncated
* Show the comment at the end so users actually see it
* Format the comment as comment

Signed-off-by: Jonas <jonas@freesources.org>
  • Loading branch information
mejo- committed Nov 14, 2023
1 parent 8d247b5 commit 3f527ae
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions core/Command/Background/ListCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,11 @@ protected function configure(): void {

protected function execute(InputInterface $input, OutputInterface $output): int {
$jobs = $this->jobList->getJobsIterator($input->getOption('class'), (int)$input->getOption('limit'), (int)$input->getOption('offset'));
if ($input->getOption('output') === self::OUTPUT_FORMAT_PLAIN) {
$output->writeln("Output is currently limited to first " . $input->getOption('limit') . " jobs. Specify `-l, --limit[=LIMIT]` to override.");
$jobsInfo = $this->formatJobs($jobs);
$this->writeTableInOutputFormat($input, $output, $jobsInfo);
if ($input->getOption('output') === self::OUTPUT_FORMAT_PLAIN && count($jobsInfo) >= (int)$input->getOption('limit')) {
$output->writeln("\n<comment>Output is currently limited to first " . $input->getOption('limit') . " jobs. Specify `-l, --limit[=LIMIT]` to override.</comment>");
}
$this->writeTableInOutputFormat($input, $output, $this->formatJobs($jobs));
return 0;
}

Expand Down

0 comments on commit 3f527ae

Please sign in to comment.