Skip to content

Commit dc355d5

Browse files
committed
added chunk dumping to CLI page command
1 parent 527fda2 commit dc355d5

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

cli.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ protected function setup(Options $options)
6464

6565
$options->registerCommand('page', 'Check if chunks for a given page are available (for debugging)');
6666
$options->registerArgument('page', 'The page to check', true, 'page');
67+
$options->registerOption('dump', 'Dump the chunks', 'd', false, 'page');
6768

6869
$options->registerCommand('tsv', 'Create TSV files for visualizing at http://projector.tensorflow.org/' .
6970
' Not supported on all storages.');
@@ -95,7 +96,7 @@ protected function main(Options $options)
9596
$this->split($options->getArgs()[0]);
9697
break;
9798
case 'page':
98-
$this->page($options->getArgs()[0]);
99+
$this->page($options->getArgs()[0], $options->getOpt('dump'));
99100
break;
100101
case 'info':
101102
$this->showinfo();
@@ -157,7 +158,7 @@ protected function printTable($data, $level = 0)
157158
* @param string $page
158159
* @return void
159160
*/
160-
protected function page($page)
161+
protected function page($page, $dump = false)
161162
{
162163
$indexer = new Indexer();
163164
$pages = $indexer->getPages();
@@ -172,6 +173,9 @@ protected function page($page)
172173
$chunks = $storage->getPageChunks($page, $pos * 100);
173174
if ($chunks) {
174175
$this->success('Found ' . count($chunks) . ' chunks');
176+
if ($dump) {
177+
echo json_encode($chunks, JSON_PRETTY_PRINT);
178+
}
175179
} else {
176180
$this->error('No chunks found');
177181
}

0 commit comments

Comments
 (0)