add --short option to simplify the output

This commit is contained in:
Simon Vieille 2019-04-25 12:50:02 +02:00
parent 55d56ad9f0
commit 9eccda5103
Signed by: deblan
GPG key ID: 03383D15A1D31745

View file

@ -9,6 +9,7 @@ use Symfony\Component\Console\Command\Command as BaseCommand;
use Symfony\Component\Console\Helper\Table; use Symfony\Component\Console\Helper\Table;
use Symfony\Component\Process\Process; use Symfony\Component\Process\Process;
use Deblan\Whois\Parser; use Deblan\Whois\Parser;
use Symfony\Component\Console\Input\InputOption;
/** /**
* class CheckCommand. * class CheckCommand.
@ -45,6 +46,7 @@ class CheckCommand extends BaseCommand
$this $this
->setName('check') ->setName('check')
->addArgument('domains', InputArgument::IS_ARRAY | InputArgument::REQUIRED, 'List of domains.') ->addArgument('domains', InputArgument::IS_ARRAY | InputArgument::REQUIRED, 'List of domains.')
->addOption('short', 's', InputOption::VALUE_NONE, 'Simplify the output.')
->setHelp(<<<'EOF' ->setHelp(<<<'EOF'
The <info>%command.name%</info> retrieves the expiration dates of the given domains. The <info>%command.name%</info> retrieves the expiration dates of the given domains.
@ -66,6 +68,10 @@ EOF
$table = new Table($output); $table = new Table($output);
$table->setHeaders(['Domain', 'Date']); $table->setHeaders(['Domain', 'Date']);
if ($this->input->getOption('short')) {
$table->setStyle('compact');
}
foreach ($this->sort($this->successes) as $result) { foreach ($this->sort($this->successes) as $result) {
$table->addRow([ $table->addRow([
$result['domain'], $result['domain'],