-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathazad
More file actions
30 lines (22 loc) · 752 Bytes
/
azad
File metadata and controls
30 lines (22 loc) · 752 Bytes
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
<?php
if (PHP_SAPI !== 'cli') {
exit("Error: This tool can only be used in the command line interface.");
}
define('DIRSEP', DIRECTORY_SEPARATOR);
define('CPATH', __DIR__ . DIRSEP);
define('ROOT_PATH', __DIR__ . DIRSEP);
chdir(CPATH);
$action = $argv[1] ?? 'help';
require_once 'app' . DIRSEP . 'azad' . DIRSEP . 'init.php';
$kamarbandi = new \Kamarbandi\Kamarbandi;
if (empty($action)) {
$kamarbandi->help();
} else {
$parts = explode(":", $action);
if (is_callable([$kamarbandi, $parts[0]])) {
call_user_func_array([$kamarbandi, $parts[0]], [$argv]);
} else {
echo "\n\rIt looks like your command wasn't recognized. Please check the list of available commands below.";
$kamarbandi->help();
}
}