Commit 0a547afc authored by Robert Lyon's avatar Robert Lyon
Browse files

Making sure options exist for _get_cli_params() (Bug 1394754)



Change-Id: I4f75dfc9f34c3f9e3f01d8d459b6ec7a43f13689
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent 685dfca0
......@@ -235,13 +235,14 @@ class cli {
// Remove the script name
unset ($options[0]);
$this->arguments = array();
$this->unmatched = array();
if (!empty($options)) {
// Trim off anything after a -- with no arguments
if (($key = array_search('--', $options)) !== false) {
$options = array_slice($options, 0, $key);
}
$this->arguments = array();
$this->unmatched = array();
foreach ($options as $argument) {
// Attempt to match arguments
preg_match('/^(-(-)?)([^=]*)(=(.*))?$/', $argument, $matches);
......@@ -259,6 +260,7 @@ class cli {
$this->unmatched[] = $argument;
}
}
}
return array($this->arguments, $this->unmatched);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment