Add option to dump raw statistic values

master
Lars Vierbergen 7 years ago
parent 56a31b638e
commit d9c8363407
  1. 11
      Command/DumpStatsCommand.php

@ -31,7 +31,9 @@ class DumpStatsCommand extends Command
protected function configure()
{
$this->setName('stats:dump')->addOption('module', 'm', InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Modules to fetch statistics for');
$this->setName('stats:dump')
->addOption('module', 'm', InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Modules to fetch statistics for')
->addOption('raw', null, InputOption::VALUE_NONE, 'Output raw statistics list');
}
protected function execute(InputInterface $input, OutputInterface $output)
@ -52,11 +54,16 @@ class DumpStatsCommand extends Command
'Value'
]);
foreach ($event->getStatistics() as $name => $value) {
if ($input->getOption('raw')) {
$output->writeln($name . "\t" . $value, OutputInterface::OUTPUT_RAW);
}
$table->addRow([
$name,
$value
]);
}
$table->render();
if (!$input->getOption('raw')) {
$table->render();
}
}
}