From 04c282466b752171af71975cfdcf16b2990eca97 Mon Sep 17 00:00:00 2001 From: Jason Etheridge Date: Thu, 16 Apr 2020 09:47:29 -0400 Subject: [PATCH] seed kmig-quick with emig-quick --- kmig.d/bin/mig-quick | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 66 insertions(+), 0 deletions(-) create mode 100755 kmig.d/bin/mig-quick diff --git a/kmig.d/bin/mig-quick b/kmig.d/bin/mig-quick new file mode 100755 index 0000000..b262e03 --- /dev/null +++ b/kmig.d/bin/mig-quick @@ -0,0 +1,66 @@ +#!/usr/bin/perl -w +############################################################################### +=pod + +=head1 NAME + +mig-quick + +A wrapper for running the following mig commands on the specified files: + +=over 15 + +mig add +mig skip-iconv +mig clean +mig convert +mig stage + +=back + +Arguments take the form of --cmd--argument or --cmd--argument=value. + +This form is NOT supported: --cmd--argument value + +cmd must be substituted with either add, skip-iconv, clean, convert, or stage, +and determines which mig command to apply the argument toward. + +=head1 SYNOPSIS + +B [arguments...] [ ...] + +=cut + +############################################################################### + +use strict; +use Pod::Usage; +use Cwd 'abs_path'; +use FindBin; +my $mig_bin = "$FindBin::Bin/"; +use lib "$FindBin::Bin/"; +use EMig; + +my @files = grep {!/^--/} @ARGV; +my %pass_thru = ('add'=>[],'skip-iconv'=>[],'clean'=>[],'convert'=>[],'stage'=>[]); +foreach my $a (@ARGV) { + if ($a =~ /^--([a-z]+)-(.*)$/) { + $pass_thru{$1} = [] if ! defined $pass_thru{$1}; + unshift @{ $pass_thru{$1} }, "--$2"; + } +} + +foreach my $file (@files) { + foreach my $cmd (('add','skip-iconv','clean','convert','stage')) { + print "mig $cmd $file " . (join ' ', @{ $pass_thru{$cmd} }) . "\n"; + my @MYARGV = ( + 'mig' + ,$cmd + ,$file + ); + system(@MYARGV,@{ $pass_thru{$cmd} }); + } +} + +exit 0; + -- 1.7.2.5