2023-08-03 04:48:59 +00:00
|
|
|
#!/usr/bin/env php
|
|
|
|
<?php
|
|
|
|
|
2023-08-13 02:50:52 +00:00
|
|
|
declare(strict_types=1);
|
2023-08-03 04:48:59 +00:00
|
|
|
|
|
|
|
use PmConverter\Processor;
|
|
|
|
|
|
|
|
$paths = [
|
|
|
|
__DIR__ . '/../../autoload.php',
|
|
|
|
__DIR__ . '/../autoload.php',
|
|
|
|
__DIR__ . '/vendor/autoload.php'
|
|
|
|
];
|
|
|
|
$file = null;
|
|
|
|
foreach ($paths as $path) {
|
|
|
|
if (file_exists($path)) {
|
|
|
|
require_once $file = $path;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
is_null($file) && throw new RuntimeException('Unable to locate autoload.php file.');
|
|
|
|
|
2023-08-13 02:50:52 +00:00
|
|
|
$processor = new Processor($argv);
|
2023-08-03 04:48:59 +00:00
|
|
|
try {
|
2023-08-13 02:50:52 +00:00
|
|
|
$processor->convert();
|
|
|
|
} catch (InvalidArgumentException $e) {
|
|
|
|
fwrite(STDERR, sprintf('ERROR: %s%s', $e->getMessage(), PHP_EOL));
|
|
|
|
print(implode(PHP_EOL, $processor->usage()));
|
|
|
|
die(1);
|
2023-08-03 04:48:59 +00:00
|
|
|
} catch (Exception $e) {
|
|
|
|
fwrite(STDERR, sprintf('ERROR: %s%s', $e->getMessage(), PHP_EOL));
|
|
|
|
die(1);
|
|
|
|
}
|