-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmy-app
executable file
·56 lines (46 loc) · 1.86 KB
/
my-app
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
#!/usr/bin/env php
<?php
/**
* JBZoo Toolbox - Cli.
*
* This file is part of the JBZoo Toolbox project.
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @license MIT
* @copyright Copyright (C) JBZoo.com, All rights reserved.
* @see https://github.com/JBZoo/Cli
*/
declare(strict_types=1);
namespace DemoApp;
use JBZoo\Cli\CliApplication;
// Init composer autoloader
if (\file_exists(__DIR__ . '/vendor/autoload.php')) {
require_once __DIR__ . '/vendor/autoload.php';
} else {
require_once \dirname(__DIR__) . '/vendor/autoload.php';
}
// Set your application name and version.
$application = new CliApplication('My Console Application', 'v1.0.0');
// Looks at the online generator of ASCII logos
// https://patorjk.com/software/taag/#p=testall&f=Epic&t=My%20Console%20App
$application->setLogo(
<<<'EOF'
__ __ _____ _
| \/ | / ____| | | /\
| \ / |_ _ | | ___ _ __ ___ ___ | | ___ / \ _ __ _ __
| |\/| | | | | | | / _ \| '_ \/ __|/ _ \| |/ _ \ / /\ \ | '_ \| '_ \
| | | | |_| | | |___| (_) | | | \__ \ (_) | | __/ / ____ \| |_) | |_) |
|_| |_|\__, | \_____\___/|_| |_|___/\___/|_|\___| /_/ \_\ .__/| .__/
__/ | | | | |
|___/ |_| |_|
EOF,
);
// Scan directory to find commands.
// * It doesn't work recursively!
// * They must be inherited from the class \JBZoo\Cli\CliCommand
$application->registerCommandsByPath(__DIR__ . '/Commands', __NAMESPACE__);
// Action name by default (if there is no arguments)
$application->setDefaultCommand('list');
// Run application
$application->run();