Show help when --help is included, not only if parsing fails and then --help is included
This commit is contained in:
7
bin/acme
7
bin/acme
@@ -105,14 +105,16 @@ try {
|
|||||||
unset($args[1]);
|
unset($args[1]);
|
||||||
|
|
||||||
$climate->arguments->add($definition);
|
$climate->arguments->add($definition);
|
||||||
$climate->arguments->parse(array_values($args));
|
|
||||||
} catch (Exception $e) {
|
|
||||||
if (count($argv) === 3 && in_array($argv[2], ["h", "-h", "--help", "help"], true)) {
|
if (count($argv) === 3 && in_array($argv[2], ["h", "-h", "--help", "help"], true)) {
|
||||||
$climate->usage(["{$binary} {$argv[1]}"]);
|
$climate->usage(["{$binary} {$argv[1]}"]);
|
||||||
$climate->br();
|
$climate->br();
|
||||||
|
|
||||||
exit(0);
|
exit(0);
|
||||||
} else {
|
} else {
|
||||||
|
$climate->arguments->parse(array_values($args));
|
||||||
|
}
|
||||||
|
} catch (Exception $e) {
|
||||||
$climate->usage(["{$binary} {$argv[1]}"]);
|
$climate->usage(["{$binary} {$argv[1]}"]);
|
||||||
$climate->br();
|
$climate->br();
|
||||||
|
|
||||||
@@ -120,7 +122,6 @@ try {
|
|||||||
$climate->br();
|
$climate->br();
|
||||||
|
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$injector = new Injector;
|
$injector = new Injector;
|
||||||
|
|||||||
Reference in New Issue
Block a user