0017667: The command "processmaker help OPTION" shows PHP warnings if the option doesn't exist SOLVED

al ejecutar el comando processmaker help con una opcion que no existia daba un error que no era entendible para el usuario
se soluciono agregando un array que jala todas las opciones y una condicion que al dar cualquier opcion que no este listada dira que no existe
This commit is contained in:
ricardo
2015-06-30 16:13:30 -04:00
parent bc0cf966c6
commit 552aadef47

View File

@@ -150,6 +150,25 @@ class CLI
$tasks = join( "\n", $tasks );
echo $tasks . "\n\n";
} else {
$options = array();
$tasks = array();
ksort( self::$tasks );
foreach (self::$tasks as $name => $data) {
$description = explode( "\n", $data['description'] );
$options[] = "$name";
}
if (!in_array($taskName, $options)) {
echo "\nThe task does not exist \n";
echo "Use one of the following tasks:\n";
$tasks = array ();
ksort( self::$tasks );
foreach (self::$tasks as $name => $data) {
$description = explode( "\n", $data['description'] );
$tasks[] = " $name";
}
$tasks = join( "\n", $tasks );
echo $tasks . "\n\n";
} else{
$valid_args = array ();
foreach (self::$tasks[$taskName]['args'] as $arg => $data) {
$arg = strtoupper( $arg );
@@ -196,6 +215,7 @@ EOT;
echo $message . "\n";
}
}
}
/**
* Run the CLI task, which will check which command is specified and run it.