Merged in ricviscarra/processmaker/PM-3027_2 (pull request #2394)
0017667: The command "processmaker help OPTION" shows PHP warnings if the option doesn't exist SOLVED
This commit is contained in:
@@ -150,17 +150,36 @@ class CLI
|
||||
$tasks = join( "\n", $tasks );
|
||||
echo $tasks . "\n\n";
|
||||
} else {
|
||||
$valid_args = array ();
|
||||
foreach (self::$tasks[$taskName]['args'] as $arg => $data) {
|
||||
$arg = strtoupper( $arg );
|
||||
if ($data['multiple']) {
|
||||
$arg = "$arg...";
|
||||
}
|
||||
if ($data['optional']) {
|
||||
$arg = "[$arg]";
|
||||
}
|
||||
$valid_args[] = $arg;
|
||||
$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 );
|
||||
if ($data['multiple']) {
|
||||
$arg = "$arg...";
|
||||
}
|
||||
if ($data['optional']) {
|
||||
$arg = "[$arg]";
|
||||
}
|
||||
$valid_args[] = $arg;
|
||||
}
|
||||
$valid_args = join( " ", $valid_args );
|
||||
$description = explode( "\n", self::$tasks[$taskName]['description'] );
|
||||
$taskDescription = trim( array_shift( $description ) );
|
||||
@@ -195,6 +214,7 @@ EOT;
|
||||
}
|
||||
echo $message . "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user