blob: 99b0823e205edf6093f531f1d072dbee1a6370d3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
<?php
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\NullOutput;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
class MyCommand extends Command
{
protected function execute(InputInterface $input, OutputInterface $output): int
{
$ioV = new SymfonyStyle($input, $output->isVerbose() ? $output : new NullOutput());
$ioVV = new SymfonyStyle($input, $output->isVeryVerbose() ? $output : new NullOutput());
$ioVVV = new SymfonyStyle($input, $output->isDebug() ? $output : new NullOutput());
$ioV->writeln('message visible with -v only');
$ioVV->writeln('message visible with -vv only');
$ioVVV->writeln('message visible with -vvv only');
}
}
|