-
Notifications
You must be signed in to change notification settings - Fork 48
/
tower
executable file
·82 lines (59 loc) · 2.17 KB
/
tower
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/usr/bin/env php
<?php
if (PHP_SAPI !== 'cli') {
exit('Script needs to be run from Command Line Interface (cli)');
}
define('APP_CLI', true);
require __DIR__.'/bootstrap.php';
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\ConsoleOutput;
$output = new ConsoleOutput();
$APP_SPACE = null;
$APP_SPACE_DIR = __DIR__;
$spaceOption = array_search('--space', $argv);
if ($spaceOption !== false && isset($argv[$spaceOption + 1])) {
$space = $argv[$spaceOption + 1];
$spaceDir = APP_SPACES_DIR."/{$space}";
if (file_exists($spaceDir)) {
$APP_SPACE_DIR = $spaceDir;
$APP_SPACE = $space;
} else {
$output->writeln("<error>Space '{$space}' not found</error>");
exit(1);
}
}
define('APP_SPACE', $APP_SPACE ?? false);
class CockpitConsoleApp extends Application {
protected function getDefaultInputDefinition() {
$definition = parent::getDefaultInputDefinition();
// Add a global --env option
$definition->addOption(new InputOption(
'space',
null,
InputOption::VALUE_OPTIONAL,
'Space environment',
null)
);
return $definition;
}
}
$app = Cockpit::instance($APP_SPACE_DIR);
$cli = new CockpitConsoleApp("
_|_|_| _| _| _|
_| _|_| _|_|_| _| _| _|_|_| _|_|_|_|
_| _| _| _| _|_| _| _| _| _|
_| _| _| _| _| _| _| _| _| _|
_|_|_| _|_| _|_|_| _| _| _|_|_| _| _|_|
_|
_|
_|_|_|_|_|
_| _|_| _| _| _| _|_| _| _|_|
_| _| _| _| _| _| _|_|_|_| _|_|
_| _| _| _| _| _| _| _| _|
_| _|_| _| _| _|_|_| _|
{$app['app.name']} Tower", $app['app.version']);
$GLOBALS['APP'] = $app;
$app->trigger('app.cli.init', [$cli]);
//$output->writeln("<info>{$app['app.name']} Tower</info> <comment>{$app['app.version']}</comment>");
$cli->run(null, $output);