-
Notifications
You must be signed in to change notification settings - Fork 0
/
cliApp
45 lines (41 loc) · 1.03 KB
/
cliApp
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
#!/usr/bin/env php
<?php
$scripName = array_shift($argv);
//check if there're no parameters, show help and exit
if ($argc == 1 || ($argc > 1 && ($argv[0] == 'help')) ) {
echo "Usage: php $scripName [command]
Available commands:
help ( h ) this help
init initializes the application
make:[option] makes somthing
options:
something return the option (somthing)
";
exit(0);
}
$command = array_shift($argv);
if (strpos($command, 'make') === 0) {
$option = substr($command, 5);
if (!$option) {
echo "option required
Usage: php <?$scripName?> make:[option]
Available options:
something return the option (somthing)";
exit(1);
}
echo $option;
exit(0);
}else{
switch ($command) {
case 'init':
init();
break;
default:
echo "Unknown command: $command\n";
break;
}
}
function init() {
echo "Initialized";
}
?>