From: Joey Hess Date: Thu, 26 Jun 2008 21:48:43 +0000 (-0400) Subject: remember mr switches X-Git-Url: https://git.madduck.net/code/myrepos.git/commitdiff_plain/b1811adc60f81bcc868bd5484e2b5f365e068a51 remember mr switches --- diff --git a/mr b/mr index a58b52b..06b58e3 100755 --- a/mr +++ b/mr @@ -381,6 +381,7 @@ my %configfiles; my %knownactions; my %alias; my (@ok, @failed, @skipped); +my @SWITCHES=@ARGV; main(); @@ -539,7 +540,7 @@ sub action { #{{{ if ($ret >> 8 != 0) { print STDERR "mr $action: command failed\n"; if (-e "$ENV{HOME}/.mrlog" && $action ne 'remember') { - @ARGV=($action, @ARGV); + @ARGV=(@SWITCHES, $action); action("remember", $dir, $topdir, $subdir); } } @@ -1176,11 +1177,15 @@ sub init { #{{{ sub main { #{{{ getopts(); init(); + loadconfig(\*DATA); loadconfig($ENV{MR_CONFIG}); #use Data::Dumper; print Dumper(\%config); + + my $action=shift @ARGV; + @SWITCHES = grep { $_ ne $action } @SWITCHES; + $action=expandaction($action); - my $action=expandaction(shift @ARGV); dispatch($action); showstats($action);