-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathemeset.php
50 lines (35 loc) · 1.55 KB
/
emeset.php
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
<?php
require_once __DIR__ . "/vendor/autoload.php";
/*
Canvi que s'ha de fer al constructor del container per poder fer servir el cli.
$isCLI = (php_sapi_name() == 'cli');
if ($isCLI) {
$projectRootPath = getcwd();
} else {
$projectRootPath = dirname(getcwd());
}
*/
$container = new \Emeset\Container(__DIR__ . "/App/config.php");
$cli = $container["cli"]; //new App\Cli\Cli($argv, new App\Cli\Parser($argv, new \Garden\Cli\Cli()) , new App\Cli\Output(new \League\CLImate\CLImate()), new \Emeset\Caller($container), $container);
$cli->addCommand("example:cli", function ($args, $output, $container) {
$output->warning("Creant la base de dades...");
$output->success("Base de dades creada correctament");
$output->error("Base de dades creada correctament");
$output->table([
["id" => 1, "name" => "Dani"],
["id" => 2, "name" => "Pep"],
["id" => 3, "name" => "Joan"],
]);
$output->error()->bold()->echo("Hola");
$output->br();
$output->info()->border()->error()->echo("Hola")->success()->border();
}, "Exemple de les opcions del cli");
$cli->addCommand("example:table", function ($args, $output, $container) {
$output->table([
["id" => 1, "name" => "Dani"],
["id" => 2, "name" => "Pep"],
["id" => 3, "name" => "Joan"],
]);
}, "Exemple de com mostrar la informació de la taula especificada");
$cli->addCommand("config:show", [App\Commands\Config::class, "show"], "Mostra la configuració de l'aplicació");
$cli->run();