4 if (php_sapi_name() !== 'cli') {
8 require __DIR__ . '/vendor/autoload.php';
11 use Minicli\Command\CommandCall;
13 // Get the directory of the CLI "entrypoint", adjusted to be the real
14 // location where running via a phar.
16 if (str_starts_with($scriptDir, 'phar://')) {
17 $scriptDir = dirname(Phar::running(false));
20 // Load in our .env file from the parent directory
21 $dotenv = Dotenv\Dotenv::createImmutable(dirname($scriptDir));
26 $app->setSignature('./run mycommand');
28 $app->registerCommand('mycommand', function (CommandCall $input) use ($scriptDir) {
30 echo "BS URL is: " . ($_SERVER['BS_URL'] ?? '') . "\n";
31 echo "DB HOST is: " . ($_SERVER['DB_HOST'] ?? '') . "\n";
32 echo dirname($scriptDir);
37 $app->runCommand($argv);