From d63fd77da4ab01d3c30659247fb67b2bae1f6403 Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Mon, 23 Jan 2012 11:57:03 +0100 Subject: [PATCH] Allow multiple --load options --- slic3r.pl | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/slic3r.pl b/slic3r.pl index 96ac2fe0..52ffe3e1 100755 --- a/slic3r.pl +++ b/slic3r.pl @@ -23,7 +23,7 @@ my %cli_options = (); 'o|output=s' => \$opt{output}, 'save=s' => \$opt{save}, - 'load=s' => \$opt{load}, + 'load=s@' => \$opt{load}, 'ignore-nonexistent-config' => \$opt{ignore_nonexistent_config}, ); foreach my $opt_key (keys %$Slic3r::Config::Options) { @@ -37,13 +37,15 @@ my %cli_options = (); # load configuration if ($opt{load}) { - if (-e $opt{load}) { - Slic3r::Config->load($opt{load}); - } elsif (-e "$FindBin::Bin/$opt{load}") { - printf STDERR "Loaded $FindBin::Bin/$opt{load}\n"; - Slic3r::Config->load("$FindBin::Bin/$opt{load}"); - } else { - $opt{ignore_nonexistent_config} or die "Cannot find specified configuration file.\n"; + foreach my $configfile (@{$opt{load}}) { + if (-e $configfile) { + Slic3r::Config->load($configfile); + } elsif (-e "$FindBin::Bin/$configfile") { + printf STDERR "Loading $FindBin::Bin/$configfile\n"; + Slic3r::Config->load("$FindBin::Bin/$configfile"); + } else { + $opt{ignore_nonexistent_config} or die "Cannot find specified configuration file ($configfile).\n"; + } } } @@ -94,7 +96,8 @@ Usage: slic3r.pl [ OPTIONS ] file.stl --help Output this usage screen and exit --save Save configuration to the specified file - --load Load configuration from the specified file + --load Load configuration from the specified file. It can be used + more than once to load options from multiple files. -o, --output File to output gcode to (by default, the file will be saved into the same directory as the input file using the --output-filename-format to generate the filename)