[Bps-public-commit] r13952 - in Prophet/trunk: .
sartak at bestpractical.com
sartak at bestpractical.com
Thu Jul 10 13:57:56 EDT 2008
Author: sartak
Date: Thu Jul 10 13:57:56 2008
New Revision: 13952
Modified:
Prophet/trunk/ (props changed)
Prophet/trunk/lib/Prophet/CLI.pm
Log:
r64054 at onn: sartak | 2008-07-10 13:57:35 -0400
Smarter argument parsing. "--batch --luid 1" goes from (batch => '--luid', 1 => undef) to (batch => undef, luid => 1)
Modified: Prophet/trunk/lib/Prophet/CLI.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/CLI.pm (original)
+++ Prophet/trunk/lib/Prophet/CLI.pm Thu Jul 10 13:57:56 2008
@@ -158,7 +158,13 @@
($name,$val)= split(/=/,$name,2) if ($name =~/=/);
$name =~ s/^--//;
- $self->set_arg($name => ($val || shift @ARGV));
+
+ # no value specified, pull it from the next argument, unless the next
+ # argument is another option
+ $val = shift @ARGV
+ if !defined($val) && @ARGV && $ARGV[0] !~ /^--/;
+
+ $self->set_arg($name => $val);
}
}
More information about the Bps-public-commit
mailing list