added quiet option
This commit is contained in:
parent
d5bdb1bade
commit
ccb3479568
|
@ -26,11 +26,13 @@ require dirname(path: __DIR__) . '/vendor/autoload.php';
|
||||||
|
|
||||||
|
|
||||||
$shortOpts = 'v::'; // version
|
$shortOpts = 'v::'; // version
|
||||||
|
$shortOpts = 'q::'; // version
|
||||||
$shortOpts .= "V::"; // verbose
|
$shortOpts .= "V::"; // verbose
|
||||||
$shortOpts .= "h::"; // help
|
$shortOpts .= "h::"; // help
|
||||||
|
|
||||||
$longOpts = [
|
$longOpts = [
|
||||||
'version::',
|
'version::',
|
||||||
|
'quiet::',
|
||||||
'verbose::',
|
'verbose::',
|
||||||
'help::'
|
'help::'
|
||||||
];
|
];
|
||||||
|
@ -47,6 +49,13 @@ if (array_key_exists(key: 'h', array: $options) || array_key_exists(key: 'help',
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (array_key_exists(key: 'q', array: $options) || array_key_exists(key: 'quiet', array: $options)) {
|
||||||
|
$quiet = true;
|
||||||
|
} else {
|
||||||
|
$quiet = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (array_key_exists(key: 'V', array: $options) || array_key_exists(key: 'verbose', array: $options)) {
|
if (array_key_exists(key: 'V', array: $options) || array_key_exists(key: 'verbose', array: $options)) {
|
||||||
$verbose = true;
|
$verbose = true;
|
||||||
} else {
|
} else {
|
||||||
|
@ -56,8 +65,8 @@ if (array_key_exists(key: 'V', array: $options) || array_key_exists(key: 'verbos
|
||||||
$arguments = array_slice(array: $argv, offset: $restIndex);
|
$arguments = array_slice(array: $argv, offset: $restIndex);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$app = new BindAPI(verbose: $verbose );
|
$app = new BindAPI(verbose: $verbose, quiet: $quiet);
|
||||||
$app->runCommand(argumentsCount: count(value: $arguments), arguments: $arguments);
|
$app->runCommand(arguments: $arguments);
|
||||||
|
|
||||||
} catch (DependencyException|NotFoundException|Exception $e) {
|
} catch (DependencyException|NotFoundException|Exception $e) {
|
||||||
echo $e->getMessage() . PHP_EOL;
|
echo $e->getMessage() . PHP_EOL;
|
||||||
|
|
Loading…
Reference in New Issue