Skip to content
Snippets Groups Projects
Commit f7c9ddbf authored by Jared Hancock's avatar Jared Hancock
Browse files

Fixup argument parsing with no args (store_true)

parent 29dce5a8
No related branches found
No related tags found
No related merge requests found
...@@ -34,7 +34,7 @@ class Option { ...@@ -34,7 +34,7 @@ class Option {
function handleValue(&$destination, $args) { function handleValue(&$destination, $args) {
$nargs = 0; $nargs = 0;
$value = array_shift($args); $value = ($this->hasArg()) ? array_shift($args) : null;
if ($value[0] == '-') if ($value[0] == '-')
$value = null; $value = null;
elseif ($value) elseif ($value)
...@@ -62,7 +62,7 @@ class Option { ...@@ -62,7 +62,7 @@ class Option {
function toString() { function toString() {
$short = explode(':', $this->short); $short = explode(':', $this->short);
$long = explode(':', $this->long); $long = explode(':', $this->long);
if ($this->nargs == '?') if ($this->nargs === '?')
$switches = sprintf(' %s [%3$s], %s[=%3$s]', $short[0], $switches = sprintf(' %s [%3$s], %s[=%3$s]', $short[0],
$long[0], $this->metavar); $long[0], $this->metavar);
elseif ($this->hasArg()) elseif ($this->hasArg())
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment