Skip to content

Commit 002fc42

Browse files
committed
Add cli entrypoint for import
1 parent b3e6e10 commit 002fc42

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

bin/import.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/usr/bin/env php
2+
<?php
3+
4+
use Xhgui\Profiler\ImporterFactory;
5+
6+
require __DIR__ . '/../vendor/autoload.php';
7+
8+
$importer = ImporterFactory::create();
9+
10+
if ($argc <= 1) {
11+
throw new RuntimeException('Missing input filename');
12+
}
13+
14+
$filename = $argv[1];
15+
if (!is_readable($filename)) {
16+
throw new RuntimeException($filename . ' isn\'t readable');
17+
}
18+
19+
$fp = fopen($filename, 'r');
20+
if (!$fp) {
21+
throw new RuntimeException('Can\'t open ' . $filename);
22+
}
23+
$importer->import($fp);
24+
fclose($fp);

0 commit comments

Comments
 (0)