diff options
author | Urban Müller | 2016-10-24 15:21:16 +0200 |
---|---|---|
committer | Urban Müller | 2016-10-24 15:21:16 +0200 |
commit | e456347ffea5ee15fba229525f22a96b78865455 (patch) | |
tree | 5e0c9eb7bffda9fa982ae9a624549922255937ec /it.class | |
parent | 0273fc523cf88b1d517160ab3f7ea0ce428b9c43 (diff) | |
download | itools-e456347ffea5ee15fba229525f22a96b78865455.tar.gz itools-e456347ffea5ee15fba229525f22a96b78865455.tar.bz2 itools-e456347ffea5ee15fba229525f22a96b78865455.zip |
$noopts should not affect fetching of named parameters
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) { |