2020-08-26 19:56:06 +02:00
|
|
|
#!/usr/bin/env php
|
|
|
|
<?php
|
|
|
|
|
2020-08-27 18:49:51 +02:00
|
|
|
// Find where the composer autoload is
|
|
|
|
// This tool was installed as a composed dependency or directly
|
|
|
|
$root = realpath(dirname(__DIR__));
|
|
|
|
$autoload_locations = array(
|
|
|
|
__DIR__ . '/../../../autoload.php',
|
|
|
|
$root . DIRECTORY_SEPARATOR . 'vendor/autoload.php'
|
|
|
|
);
|
|
|
|
foreach ($autoload_locations as $file) {
|
|
|
|
if (file_exists($file)) {
|
|
|
|
define('ORBIT_COMPOSER_AUTOLOAD', $file);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Composer autoload require guard
|
|
|
|
if (!defined('ORBIT_COMPOSER_AUTOLOAD')) {
|
|
|
|
die(
|
|
|
|
"You must run the command `composer install` from the terminal "
|
|
|
|
. "in the directory '$root' before using this tool.\n"
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Load composer autoloader
|
|
|
|
$autoload = require_once ORBIT_COMPOSER_AUTOLOAD;
|
2020-08-27 00:57:01 +02:00
|
|
|
|
|
|
|
// Define command line args for this client
|
|
|
|
// And fetch args passed in by invocation
|
|
|
|
$args = new \Qi_Console_ArgV(
|
|
|
|
$argv,
|
2020-08-27 00:58:25 +02:00
|
|
|
[
|
2020-08-31 08:04:44 +02:00
|
|
|
'config|c:' => 'Use specified config file (.ini) for configuration',
|
2020-08-27 05:16:05 +02:00
|
|
|
'host:' => 'Set host/ip address to listen on (default 0.0.0.0)',
|
2020-08-27 00:57:01 +02:00
|
|
|
'port|p:' => 'Set port to listen on (default 1965)',
|
2020-08-31 08:04:44 +02:00
|
|
|
'hostname:' => 'Set hostname of server (default localhost)',
|
2020-08-27 05:16:05 +02:00
|
|
|
'tls-cert:' => 'Set cert PEM file to use (default null)',
|
|
|
|
'tls-key:' => 'Set private key PEM file to use (default null)',
|
2020-09-28 16:35:13 +02:00
|
|
|
'tls-passphrase:' => 'Set passphrase for private key',
|
2020-08-27 08:37:46 +02:00
|
|
|
'root-dir:' => 'Set the file root directory',
|
2020-08-27 00:57:01 +02:00
|
|
|
'log:' => 'Set log filename (default orbit.log)',
|
2020-08-31 08:04:44 +02:00
|
|
|
'dev' => 'Allow developer server functions (default false)',
|
2020-08-27 00:57:01 +02:00
|
|
|
'help|h' => 'Show help',
|
|
|
|
'verbose|v' => 'Include more verbose output',
|
|
|
|
'quiet|q' => 'Print less messages',
|
|
|
|
'no-color' => 'Don\'t use color output',
|
|
|
|
'version' => 'Show version and exit',
|
2020-08-27 00:58:25 +02:00
|
|
|
]
|
2020-08-26 19:56:06 +02:00
|
|
|
);
|
2020-08-27 00:57:01 +02:00
|
|
|
$terminal = new \Qi_Console_Terminal();
|
2020-08-31 08:04:44 +02:00
|
|
|
$error_handler = new \Qi_Console_ExceptionHandler($terminal, true, true);
|
2020-08-27 00:57:01 +02:00
|
|
|
$console = new \Orbit\Console($args, $terminal);
|
2020-08-26 19:56:06 +02:00
|
|
|
|
2020-08-27 00:57:01 +02:00
|
|
|
$value = $console->execute();
|
|
|
|
exit($value);
|