Workaround for upstream module bug causing command line option parsing for multi-boolean options like retract-layer-change and wipe

This commit is contained in:
Alessandro Ranellucci 2014-04-19 19:14:41 +02:00
parent 5d10ef514f
commit 7041ebdd22
5 changed files with 26 additions and 8 deletions

View file

@ -58,9 +58,13 @@ sub new_from_cli {
my $self = $class->new;
foreach my $opt_key (keys %args) {
if ($opt_key =~ /^(?:print_center|bed_size|duplicate_grid|extruder_offset|retract_layer_change|wipe)$/) {
my $opt_def = $Options->{$opt_key};
# we use set_deserialize() for bool options since GetOpt::Long doesn't handle
# arrays of boolean values
if ($opt_key =~ /^(?:print_center|bed_size|duplicate_grid|extruder_offset)$/ || $opt_def->{type} eq 'bool') {
$self->set_deserialize($opt_key, $args{$opt_key});
} elsif (my $shortcut = $Options->{$opt_key}{shortcut}) {
} elsif (my $shortcut = $opt_def->{shortcut}) {
$self->set($_, $args{$opt_key}) for @$shortcut;
} else {
$self->set($opt_key, $args{$opt_key});