]> 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:

allow aliases to override defined commands
[code/myrepos.git] / mr
diff --git a/mr b/mr
index 5c9d6a3a969640c8c73110f610ec61400bb04063..01a9feb6ae1001e8c97258423832202fd25f4e82 100755 (executable)
--- a/mr
+++ b/mr
@@ -218,24 +218,22 @@ eval {
 
 # alias expansion and command stemming
 my $action=shift @ARGV;
 
 # alias expansion and command stemming
 my $action=shift @ARGV;
+if (exists $alias{$action}) {
+       $action=$alias{$action};
+}
 if (! exists $knownactions{$action}) {
 if (! exists $knownactions{$action}) {
-       if (exists $alias{$action}) {
-               $action=$alias{$action};
+       my @matches = grep { /^\Q$action\E/ }
+               keys %knownactions, keys %alias;
+       if (@matches == 1) {
+               $action=$matches[0];
+       }
+       elsif (@matches == 0) {
+               die "mr: unknown action \"$action\" (known actions: ".
+                       join(", ", sort keys %knownactions).")\n";
        }
        else {
        }
        else {
-               my @matches = grep { /^\Q$action\E/ }
-                       keys %knownactions, keys %alias;
-               if (@matches == 1) {
-                       $action=$matches[0];
-               }
-               elsif (@matches == 0) {
-                       die "mr: unknown action \"$action\" (known actions: ".
-                               join(", ", sort keys %knownactions).")\n";
-               }
-               else {
-                       die "mr: ambiguous action \"$action\" (matches: ".
-                               join(", ", @matches).")\n";
-               }
+               die "mr: ambiguous action \"$action\" (matches: ".
+                       join(", ", @matches).")\n";
        }
 }
 
        }
 }
 
@@ -473,12 +471,14 @@ __DATA__
        co = checkout
        ci = commit
        ls = list
        co = checkout
        ci = commit
        ls = list
+
 [default]
 lib = \
        error() { \
                echo "mr: $@" >&2; \
                exit 1; \
        }
 [default]
 lib = \
        error() { \
                echo "mr: $@" >&2; \
                exit 1; \
        }
+
 update = \
        if [ -d "$MR_REPO"/.svn ]; then \
                svn update "$@"; \
 update = \
        if [ -d "$MR_REPO"/.svn ]; then \
                svn update "$@"; \
@@ -530,9 +530,13 @@ log = \
                error "unknown repo type"; \
        fi
 list = true
                error "unknown repo type"; \
        fi
 list = true
+
 help = \
        if [ ! -e "$MR_PATH" ]; then \
                error "cannot find program path";\
        fi; \
        (pod2man -c mr "$MR_PATH" | man -l -) || \
                error "pod2man or man failed"
 help = \
        if [ ! -e "$MR_PATH" ]; then \
                error "cannot find program path";\
        fi; \
        (pod2man -c mr "$MR_PATH" | man -l -) || \
                error "pod2man or man failed"
+
+ed = echo "A horse is a horse, of course, of course.."
+T = echo "I pity the fool."