]> git.madduck.net Git - code/myrepos.git/blobdiff - mr

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

remember mr switches
[code/myrepos.git] / mr
diff --git a/mr b/mr
index a58b52ba1a719b08208ee04fa01014e9535d41bf..2e5b03dc983a3f9f64e997eb2569b5cab10c2b0b 100755 (executable)
--- 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);