added quiet option

This commit is contained in:
tracer 2022-09-21 15:58:48 +02:00
parent d5bdb1bade
commit ccb3479568
1 changed files with 11 additions and 2 deletions

13
bin/console Normal file → Executable file
View File

@ -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;