From b0303c1e3bf2176319d51c47756c1f202c53dc37 Mon Sep 17 00:00:00 2001 From: Mark Hindess Date: Sun, 20 May 2012 17:01:40 +0100 Subject: [PATCH] Allow cli options to use '_' instead of '-'. This makes it easier to copy and paste options from config files. --- slic3r.pl | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/slic3r.pl b/slic3r.pl index 883cb0e68..c223aaa7e 100755 --- a/slic3r.pl +++ b/slic3r.pl @@ -30,8 +30,12 @@ my %cli_options = (); ); foreach my $opt_key (keys %$Slic3r::Config::Options) { my $opt = $Slic3r::Config::Options->{$opt_key}; - $options{ $opt->{cli} } = \$cli_options{$opt_key} - if $opt->{cli}; + my $cli = $opt->{cli} or next; + if ($cli =~ /-/) { + # allow alternative options with '_' in place of '-' + $cli = $opt_key.'|'.$cli; + } + $options{ $cli } = \$cli_options{$opt_key}; } GetOptions(%options) or usage(1);