Skip to content

Commit 86631e7

Browse files
Update argv() to properly parse --two-word arguments (Addresses #288)
1 parent feba20f commit 86631e7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

diff-so-fancy

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -626,8 +626,9 @@ sub argv {
626626
my $ret = {};
627627

628628
for (my $i = 0; $i < scalar(@ARGV); $i++) {
629+
629630
# If the item starts with "-" it's a key
630-
if ((my ($key) = $ARGV[$i] =~ /^--?([a-zA-Z_]\w*)/) && ($ARGV[$i] !~ /^-\w\w/)) {
631+
if ((my ($key) = $ARGV[$i] =~ /^--?([a-zA-Z_-]*\w)$/) && ($ARGV[$i] !~ /^-\w\w/)) {
631632
# If the next item does not start with "--" it's the value for this item
632633
if (defined($ARGV[$i + 1]) && ($ARGV[$i + 1] !~ /^--?\D/)) {
633634
$ret->{$key} = $ARGV[$i + 1];

0 commit comments

Comments
 (0)