New --post-process option. Includes some cleaning of the STDOUT messages

This commit is contained in:
Alessandro Ranellucci 2012-02-20 12:50:05 +01:00
parent ae35df716f
commit 555c23069d
10 changed files with 63 additions and 28 deletions

View file

@ -254,6 +254,16 @@ our $Options = {
serialize => sub { join '\n', split /\R+/, $_[0] },
deserialize => sub { join "\n", split /\\n/, $_[0] },
},
'post_process' => {
label => 'Post-processing scripts',
cli => 'post-process=s@',
type => 's@',
multiline => 1,
width => 350,
height => 60,
serialize => sub { join '; ', @{$_[0]} },
deserialize => sub { [ split /\s*;\s*/, $_[0] ] },
},
# retraction options
'retract_length' => {
@ -352,6 +362,14 @@ sub serialize {
: get($opt_key);
}
sub deserialize {
my $class = @_ == 3 ? shift : undef;
my ($opt_key, $value) = @_;
return $Options->{$opt_key}{deserialize}
? set($opt_key, $Options->{$opt_key}{deserialize}->($value))
: set($opt_key, $value);
}
sub save {
my $class = shift;
my ($file) = @_;