blob: 1ddc6f624f71a5d3d5868f5d23d430993b0aa3b5 (
plain)
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
|
<?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());
$this->ioVV = new SymfonyStyle(
$input,
$output->isVeryVerbose() ? $output : new NullOutput()
);
$this->ioVVV = new SymfonyStyle($input, $output->isDebug() ? $output : new NullOutput());
$this->ioV->writeln('message visible with -v only');
$this->ioVV->writeln('message visible with -vv only');
$this->ioVVV->writeln('message visible with -vvv only');
}
}
|