From 18c1e9bbc5d92ea1fe6fb970376eeb0e05356bce Mon Sep 17 00:00:00 2001 From: Johannes Schauer Marin Rodrigues Date: Fri, 2 Sep 2022 23:23:53 +0200 Subject: [PATCH] multiple skip options can be passed by separating them by comma or whitespace --- mmdebstrap | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/mmdebstrap b/mmdebstrap index 270dee8..cd5172e 100755 --- a/mmdebstrap +++ b/mmdebstrap @@ -4355,8 +4355,18 @@ sub main() { # here prepare for long suffering in dependency hell. 'simulate' => \$options->{dryrun}, 'dry-run' => \$options->{dryrun}, - 'skip=s@' => \$options->{skip}, - ) or pod2usage(-exitval => 2, -verbose => 1); + 'skip=s' => sub { + my ($opt_name, $opt_value) = @_; + for my $skip (split /[,\s]+/, $opt_value) { + # strip leading and trailing whitespace + $skip =~ s/^\s+|\s+$//g; + # skip if the remainder is an empty string + if ($skip eq '') { + next; + } + push @{ $options->{skip} }, $skip; + } + }) or pod2usage(-exitval => 2, -verbose => 1); if (defined($logfile)) { open(STDERR, '>', $logfile) or error "cannot open $logfile: $!"; @@ -6278,7 +6288,8 @@ B tries hard to implement sensible defaults and will try to stop you before shooting yourself in the foot. This option is for when you are sure you know what you are doing and allows one to skip certain actions and safety checks. See section B for a list of possible arguments and their -context. +context. The option can be specified multiple times or you can separate +multiple values by comma or whitespace. =item B<-q,--quiet>, B<-s,--silent>