Skip to content

Commit 9b6e7b5

Browse files
committed
getopt: don't try to parse array arguments
1 parent 9724040 commit 9b6e7b5

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

lib/getopt.ps1

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# longopts:
88
# array of strings that are long-form options. options that take
99
# a parameter should end with '='
10-
# returns @(opts hash, rem_args array, error string)
10+
# returns @(opts hash, remaining_args array, error string)
1111
function getopt($argv, $shortopts, $longopts) {
1212
$opts = @{}; $rem = @()
1313

@@ -21,6 +21,8 @@ function getopt($argv, $shortopts, $longopts) {
2121

2222
for($i = 0; $i -lt $argv.length; $i++) {
2323
$arg = $argv[$i]
24+
# don't try to parse array arguments
25+
if($arg -is [array]) { $rem += ,$arg; continue }
2426

2527
if($arg.startswith('--')) {
2628
$name = $arg.substring(2)

0 commit comments

Comments
 (0)