-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmeteor
42 lines (39 loc) · 1.84 KB
/
meteor
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
#!/usr/bin/env php
<?php
/**
|---------------------------------------------------------------|
| METEOR is a CLI PHP script that allows you to create |
| shell scripting apps, and also allowing you to manually |
| execute them or have a crontab to work for you on them. |
| The idea came originally from the artisan command (from |
| Laravel) but allowing us to create a simpler and smaller |
| version. |
|---------------------------------------------------------------|
*/
require __DIR__ . '/autoload.php';
/**
* We create a new Console object. This will help us to manage everything about the consoles.
*/
$Console = new Kataclysm\Console\Console( $argv );
/**
* Lets validate the information of the console. The basic call must include the name of the consolo command we want to execute.
*/
if( !$Console -> validate() ){
/**
* If there was an error, then lets show an error message to the screen.
*/
\Kataclysm\Console\Console::print_message( "Command missing or does not exist", \Kataclysm\Console\Console::MESSAGE_TYPE_ERROR );
}else{
// Seems good? I guess we can execute
try{
$Console -> getCommandClass() -> process();
}catch (\Error $err){
\Kataclysm\Console\Console::print_message( "An error happened", \Kataclysm\Console\Console::MESSAGE_TYPE_ERROR );
\Kataclysm\Console\Console::print_message( $err->getMessage() , \Kataclysm\Console\Console::MESSAGE_TYPE_ERROR );
}catch ( \Exception $err ){
\Kataclysm\Console\Console::print_message( "An exception happened", \Kataclysm\Console\Console::MESSAGE_TYPE_ERROR );
\Kataclysm\Console\Console::print_message( $err->getMessage() , \Kataclysm\Console\Console::MESSAGE_TYPE_ERROR );
}
}
echo PHP_EOL;
?>