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() 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) protected function execute(InputInterface $input, OutputInterface $output)
@ -52,11 +54,16 @@ class DumpStatsCommand extends Command
'Value' 'Value'
]); ]);
foreach ($event->getStatistics() as $name => $value) { foreach ($event->getStatistics() as $name => $value) {
if ($input->getOption('raw')) {
$output->writeln($name . "\t" . $value, OutputInterface::OUTPUT_RAW);
}
$table->addRow([ $table->addRow([
$name, $name,
$value $value
]); ]);
} }
$table->render(); if (!$input->getOption('raw')) {
$table->render();
}
} }
} }