-
Notifications
You must be signed in to change notification settings - Fork 1
/
berlioz
executable file
·46 lines (40 loc) · 1.18 KB
/
berlioz
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env php
<?php
/**
* This file is part of Berlioz framework.
*
* @license https://opensource.org/licenses/MIT MIT License
* @copyright 2018 Ronan GIRON
* @author Ronan GIRON <https://github.com/ElGigi>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code, to the root.
*/
declare(strict_types=1);
// Find autoload of Composer
$autoloadFile = null;
$autoloadFiles = [__DIR__ . '/../../autoload.php',
__DIR__ . '/../autoload.php',
__DIR__ . '/../vendor/autoload.php',
__DIR__ . '/vendor/autoload.php'];
foreach ($autoloadFiles as $file) {
if (true === file_exists($file)) {
$autoloadFile = $file;
break;
}
}
if (null === $autoloadFile) {
fwrite(STDERR, 'You must install Berlioz/CliCore with Composer, looks at https://getcomposer.org/ to do that.' . PHP_EOL);
exit(1);
}
// Load autoload file of Composer
require $autoloadFile;
// Application
try {
// App
$app = new \Berlioz\Cli\Core\App\CliApp();
exit($app->handle());
} catch (\Throwable $e) {
fwrite(STDERR, rtrim((string) $e) . PHP_EOL);
exit(1);
}