X-Git-Url: https://git.madduck.net/code/myrepos.git/blobdiff_plain/056bfc218e74821f28990c305d695a02d35363a0..3cba68134c64156e30c1c19148c1e73990e7a2f1:/mr diff --git a/mr b/mr index a58b52b..2e5b03d 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, @ARGV); 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);