diff options
author | Nathan Gass | 2024-02-21 10:22:32 +0100 |
---|---|---|
committer | Nathan Gass | 2024-02-21 10:22:32 +0100 |
commit | 486126e92b87d9ca32ae2596f74054c234cd7a19 (patch) | |
tree | 6c682bbdb050b8d42725d28cf7d8c70b944a68ca | |
parent | 19a29ba848ac66fedbbb7059df09f93675e48a26 (diff) | |
download | itools-486126e92b87d9ca32ae2596f74054c234cd7a19.tar.gz itools-486126e92b87d9ca32ae2596f74054c234cd7a19.tar.bz2 itools-486126e92b87d9ca32ae2596f74054c234cd7a19.zip |
it::getopt: do not eat up second --
-rw-r--r-- | it.class | 2 | ||||
-rwxr-xr-x | test/it.t | 1 |
2 files changed, 2 insertions, 1 deletions
@@ -950,7 +950,7 @@ static function getopt($usage, $p = array()) { if ($eat) $result[array_shift($eat)] = $arg; - else if ($arg == "--") + else if (!$noopts && $arg == "--") $noopts = true; else if (!$noopts && ($matches = (array)it::match('^--(\w[\w-]*)(=.*)?', $arg))) { @@ -565,6 +565,7 @@ function requesturi($teststring, $expect) _getopt(["val"], ['foo' => "val"]); _getopt(["--", "-val"], ['foo' => "-val"]); +_getopt(["--", "--"], ['foo' => "--"]); _getopt(["-v", "val"], ['verbose' => true, 'foo' => "val"]); _getopt(["--verbose", "val"], ['verbose' => true, 'foo' => "val"]); _getopt(["-vw", "val"], ['verbose' => true, 'werbose' => true, 'foo' => "val"]); |