Skip to content
Snippets Groups Projects
Commit 5778d580 authored by Leo Gordon's avatar Leo Gordon
Browse files

fixed a bug that prevented parsing of lists; also allow destringification of values from cmdline

parent a76403b6
No related branches found
No related tags found
No related merge requests found
......@@ -86,7 +86,7 @@ sub destringify {
if($value=~/^'.*'$/
or $value=~/^".*"$/
or $value=~/^{.*}$/
or $value=~/^[.*]$/) {
or $value=~/^\[.*\]$/) {
$value = eval($value);
}
......@@ -133,12 +133,12 @@ sub parse_cmdline_options {
my $temp_key;
foreach my $arg (@ARGV) {
if($temp_key) {
$pairs{$temp_key} = $arg;
if($temp_key) { # only the value, get the key from buffer
$pairs{$temp_key} = destringify($arg);
$temp_key = '';
} elsif($arg=~/^--?(\w+)=(.+)$/) {
$pairs{$1} = $2;
} elsif($arg=~/^--?(\w+)$/) {
} elsif($arg=~/^--?(\w+)=(.+)$/) { # both the key and the value
$pairs{$1} = destringify($2);
} elsif($arg=~/^--?(\w+)$/) { # only the key, buffer it and expect the value on the next round
$temp_key = $1;
} else {
push @list, $arg;
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment