Skip to content

Commit

Permalink
getopt: don't try to parse array arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
lukesampson committed Sep 6, 2013
1 parent 9724040 commit 9b6e7b5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/getopt.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# longopts:
# array of strings that are long-form options. options that take
# a parameter should end with '='
# returns @(opts hash, rem_args array, error string)
# returns @(opts hash, remaining_args array, error string)
function getopt($argv, $shortopts, $longopts) {
$opts = @{}; $rem = @()

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

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

if($arg.startswith('--')) {
$name = $arg.substring(2)
Expand Down

0 comments on commit 9b6e7b5

Please sign in to comment.