Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix command line parsing (RT #114720)
  • Loading branch information
moritz committed Oct 14, 2012
1 parent 56ae4f0 commit 86b5b43
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 0 additions & 4 deletions src/HLL/CommandLine.pm
Expand Up @@ -199,10 +199,6 @@ class HLL::CommandLine::Parser {
sub get-value($opt) {
if $i == $arg-count - 1 {
nqp::die("Option $opt needs a value");
} elsif self.is-option(@args[$i + 1]) {
nqp::die("Option $opt needs a value, but is followed by an option");
} elsif %!stopper{@args[$i + 1]} {
nqp::die("Option $opt needs a value, but is followed by a stopper");
} else {
$i++;
@args[$i];
Expand Down
6 changes: 5 additions & 1 deletion t/hll/05-commandline.t
@@ -1,6 +1,6 @@
#! nqp

plan(30);
plan(31);

use NQPHLL;

Expand Down Expand Up @@ -81,3 +81,7 @@ ok($r.options<other> eq 'v3', 'long|short alias (short)');

$r := $x.parse(['-w', 'A', '-w', 'B']);
ok(nqp::join(',', $r.options<w>) eq 'A,B', 'multiple options with the same name');

$x := HLL::CommandLine::Parser.new(['e=s']);
$r := $x.parse(['-e', '-1 < 0']);
ok($r.options<e> eq '-1 < 0', 'can have option values that start with a dash');

0 comments on commit 86b5b43

Please sign in to comment.