-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
librarian
executable file
·49 lines (40 loc) · 1.45 KB
/
librarian
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
47
48
49
#!/usr/bin/env php
<?php
if (php_sapi_name() !== 'cli') {
exit;
}
require __DIR__ . '/vendor/autoload.php';
use Librarian\Builder\StaticBuilder;
use Librarian\Provider\LibrarianServiceProvider;
use Librarian\Provider\TwigServiceProvider;
use Minicli\App;
use Librarian\Provider\ContentServiceProvider;
$app = new App(load_config());
$app->setSignature('
_ ____ ____ ____ ____ ____ ____ ____ ____
| | | || \ | \ / || \ | | / || \
| | | | | o )| D )| o || D ) | | | o || _ |
| |___ | | | || / | || / | | | || | |
| | | | | O || \ | _ || \ | | | _ || | |
| | | | | || . \| | || . \ | | | | || | |
|_____||____||_____||__|\_||__|__||__|\_||____||__|__||__|__|
Type "./librarian help" for help with available commands.
');
$app->addService('content', new ContentServiceProvider());
$app->addService('twig', new TwigServiceProvider());
$app->addService('librarian', new LibrarianServiceProvider());
$app->addService('builder', new StaticBuilder());
$app->librarian->boot();
try {
$app->runCommand($argv);
} catch (CommandNotFoundException $notFoundException) {
$app->getPrinter()->error("Command Not Found.");
return 1;
} catch (Exception $exception) {
if ($app->config->debug) {
$app->getPrinter()->error("An error occurred:");
$app->getPrinter()->error($exception->getMessage());
}
return 1;
}
return 0;