diff options
Diffstat (limited to 'it.class')
-rw-r--r-- | it.class | 8 |
1 files changed, 3 insertions, 5 deletions
@@ -795,9 +795,7 @@ static function getopt($usage, $p = array()) foreach (array_slice($_SERVER['argv'], 1) as $arg) { - if ($noopts) - $result['args'][] = $seenarg = $arg; - else if ($eat) + if ($eat) { if (it::match('^--?\w', $arg)) # Already next option => Missing argument? $err = true; @@ -806,7 +804,7 @@ static function getopt($usage, $p = array()) } else if ($arg == "--") $noopts = true; - elseif ($matches = (array)it::match('^--(\w[\w-]*)(=.*)?', $arg)) + elseif (!$noopts && ($matches = (array)it::match('^--(\w[\w-]*)(=.*)?', $arg))) { list($optname, $val) = $matches; if (!isset($witharg[$optname]) || isset($val) && !$witharg[$optname]) @@ -816,7 +814,7 @@ static function getopt($usage, $p = array()) else $result[$optname] = $val ? substr($val, 1) : true; } - else if (($letters = it::match('^-(\w+)', $arg)) || $letters === "0") + else if (!$noopts && (($letters = it::match('^-(\w+)', $arg)) || $letters === "0")) { foreach (explode("\n", trim(chunk_split($letters, 1, "\n"))) as $letter) { |