projects
/
pharext
/
pharext.org
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
cli: virtual commands options
[pharext/pharext.org]
/
app
/
Cli.php
diff --git
a/app/Cli.php
b/app/Cli.php
index 56dbc5c9bc2a617aca94b5e01b7e64d5bd53bf12..be2211de38dc849bf859553806cb2a4fffd665d6 100644
(file)
--- a/
app/Cli.php
+++ b/
app/Cli.php
@@
-28,6
+28,7
@@
class Cli
}
if ($this->args["help"] || !array_filter($this->args->toArray())) {
}
if ($this->args["help"] || !array_filter($this->args->toArray())) {
+ //var_dump($this->args->toArray(), $this->args[0]);
$this->help($prog);
exit;
}
$this->help($prog);
exit;
}
@@
-37,15
+38,17
@@
class Cli
exit(-1);
}
}
exit(-1);
}
}
-
- if ($this->args["ngrok"]) {
+
+ switch($this->args[0]) {
+ case "ngrok":
$exec(Cli\Ngrok::class);
$exec(Cli\Ngrok::class);
- }
- if ($this->args["initdb"]) {
+ break;
+ case "initdb":
$exec(Cli\Initdb::class);
$exec(Cli\Initdb::class);
- }
- if ($this->args["gen-models"]) {
+ break;
+ case "gen-models":
$exec(Cli\GenModels::class);
$exec(Cli\GenModels::class);
+ break;
}
}
}
}
@@
-58,6
+61,7
@@
class Cli
* @param string $prog
*/
public function help($prog) {
* @param string $prog
*/
public function help($prog) {
+ return print new Args\Help($prog, $this->args);
printf("Usage:\n\n \$ %s", $prog);
$flags = [];
printf("Usage:\n\n \$ %s", $prog);
$flags = [];