# alias expansion and command stemming
my $action=shift @ARGV;
+if (exists $alias{$action}) {
+ $action=$alias{$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 {
- 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";
}
}
}
$ENV{MR_REPO}=$dir;
- if (! $nochdir && ! chdir($dir)) {
- print STDERR "mr $action: failed to chdir to $dir: $!\n";
- push @skipped, $dir;
- }
if (exists $config{$topdir}{$subdir}{skip}) {
my $test="set -e;".$lib.$config{$topdir}{$subdir}{skip};
return;
}
}
-
- if (! exists $config{$topdir}{$subdir}{$action}) {
+
+ if (! $nochdir && ! chdir($dir)) {
+ print STDERR "mr $action: failed to chdir to $dir: $!\n";
+ push @failed, $dir;
+ }
+ elsif (! exists $config{$topdir}{$subdir}{$action}) {
print STDERR "mr $action: no defined $action command for $topdir$subdir, skipping\n";
push @skipped, $dir;
}
co = checkout
ci = commit
ls = list
+
[default]
lib = \
error() { \
echo "mr: $@" >&2; \
exit 1; \
}
+
update = \
if [ -d "$MR_REPO"/.svn ]; then \
svn update "$@"; \
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"
+
+ed = echo "A horse is a horse, of course, of course.."
+T = echo "I pity the fool."