32 lines
1.0 KiB
PHP
Executable File
32 lines
1.0 KiB
PHP
Executable File
#!/usr/bin/env php
|
|
<?php
|
|
namespace UAParser\Command;
|
|
|
|
$packageAutoloader = __DIR__ . '/../vendor/autoload.php';
|
|
$standaloneAutoloader = __DIR__ . '/../../../autoload.php';
|
|
if (file_exists($packageAutoloader)) {
|
|
require_once $packageAutoloader;
|
|
} else {
|
|
require_once $standaloneAutoloader;
|
|
}
|
|
|
|
$resourceDirectory = realpath(__DIR__ . '/../resources');
|
|
$defaultYamlFile = realpath(__DIR__ . '/../resources/regexes.yaml');
|
|
|
|
// Ensure symfony packages installed
|
|
if (!class_exists(\Symfony\Component\Console\Application::class)) {
|
|
echo 'You must include the symfony packages, see composer.json "suggest" section' . PHP_EOL;
|
|
exit(1);
|
|
}
|
|
|
|
use \Symfony\Component\Console\Application;
|
|
|
|
$application = new Application('ua-parser');
|
|
$application->add(new ConvertCommand($resourceDirectory, $defaultYamlFile));
|
|
$application->add(new UpdateCommand($resourceDirectory));
|
|
$application->add(new ParserCommand());
|
|
$application->add(new LogfileCommand());
|
|
$application->add(new FetchCommand($defaultYamlFile));
|
|
|
|
$application->run();
|