[Bps-public-commit] Prophet branch, master, updated. 0.69_01-35-g6c6e306
jesse
jesse at bestpractical.com
Wed Sep 2 23:52:47 EDT 2009
The branch, master has been updated
via 6c6e306d4afa708a0c411e4d01f2127cb698c3ba (commit)
via ca427c64305350158188a644032993b8d9290460 (commit)
via 5f4a21e6f90ecaebdcfe689da2b68e778c9c87a5 (commit)
via b66155b3a0872f1a1cc5117527f49cb6400c146f (commit)
from a774328e278e08ad7086a5f445eefc51a0fde792 (commit)
Summary of changes:
lib/Prophet/CLI.pm | 13 +++++++------
1 files changed, 7 insertions(+), 6 deletions(-)
- Log -----------------------------------------------------------------
commit b66155b3a0872f1a1cc5117527f49cb6400c146f
Author: Nelson Elhage <nelhage at mit.edu>
Date: Wed Sep 2 22:53:41 2009 -0400
Remove an unnecessary 'no strict "refs"'.
Signed-off-by: Nelson Elhage <nelhage at mit.edu>
diff --git a/lib/Prophet/CLI.pm b/lib/Prophet/CLI.pm
index 8be043e..1ffc48b 100644
--- a/lib/Prophet/CLI.pm
+++ b/lib/Prophet/CLI.pm
@@ -127,8 +127,6 @@ sub _command_matches_alias {
my $alias = shift;
my $dispatch_to = shift;;
if ( $cmd =~ /^\Q$alias\E\s*(.*)$/ ) {
- no strict 'refs';
-
my $rest = $1;
# we want to start at index 1
my @captures = (undef, $self->tokenize($rest));
commit 5f4a21e6f90ecaebdcfe689da2b68e778c9c87a5
Author: Nelson Elhage <nelhage at mit.edu>
Date: Wed Sep 2 22:57:43 2009 -0400
Only expand aliases on word boundaries.
This prevents 'alias t = ticket' from expanding "ticket" into "t
icket".
Signed-off-by: Nelson Elhage <nelhage at mit.edu>
diff --git a/lib/Prophet/CLI.pm b/lib/Prophet/CLI.pm
index 1ffc48b..fd0f70c 100644
--- a/lib/Prophet/CLI.pm
+++ b/lib/Prophet/CLI.pm
@@ -126,7 +126,7 @@ sub _command_matches_alias {
my $cmd = shift;
my $alias = shift;
my $dispatch_to = shift;;
- if ( $cmd =~ /^\Q$alias\E\s*(.*)$/ ) {
+ if ( $cmd =~ /^\Q$alias\E\b\s*(.*)$/ ) {
my $rest = $1;
# we want to start at index 1
my @captures = (undef, $self->tokenize($rest));
commit ca427c64305350158188a644032993b8d9290460
Author: Nelson Elhage <nelhage at mit.edu>
Date: Wed Sep 2 22:59:17 2009 -0400
Improve argument expansion in aliases.
* Handle an unbounded number of parameters, not just 20.
* Don't throw warnings if the expansion contains more $ placeholders
than arguments.
Signed-off-by: Nelson Elhage <nelhage at mit.edu>
diff --git a/lib/Prophet/CLI.pm b/lib/Prophet/CLI.pm
index fd0f70c..ccd3c50 100644
--- a/lib/Prophet/CLI.pm
+++ b/lib/Prophet/CLI.pm
@@ -128,9 +128,8 @@ sub _command_matches_alias {
my $dispatch_to = shift;;
if ( $cmd =~ /^\Q$alias\E\b\s*(.*)$/ ) {
my $rest = $1;
- # we want to start at index 1
- my @captures = (undef, $self->tokenize($rest));
- $dispatch_to =~ s/\$$_\b/$captures[$_]/g for 1 .. 20;
+ my @captures = $self->tokenize($rest);
+ $dispatch_to =~ s/\$(\d+)\b/$captures[$1 - 1]||""/ge;
return $dispatch_to;
}
return undef;
commit 6c6e306d4afa708a0c411e4d01f2127cb698c3ba
Author: Nelson Elhage <nelhage at mit.edu>
Date: Wed Sep 2 23:01:26 2009 -0400
Support var-args aliases.
If an alias has no $n placeholders, simply append all the extra
arguments onto the expansion before executing it.
Signed-off-by: Nelson Elhage <nelhage at mit.edu>
diff --git a/lib/Prophet/CLI.pm b/lib/Prophet/CLI.pm
index ccd3c50..877b6a4 100644
--- a/lib/Prophet/CLI.pm
+++ b/lib/Prophet/CLI.pm
@@ -128,8 +128,12 @@ sub _command_matches_alias {
my $dispatch_to = shift;;
if ( $cmd =~ /^\Q$alias\E\b\s*(.*)$/ ) {
my $rest = $1;
- my @captures = $self->tokenize($rest);
- $dispatch_to =~ s/\$(\d+)\b/$captures[$1 - 1]||""/ge;
+ if ($dispatch_to =~ m{\$\d+\b}) {
+ my @captures = $self->tokenize($rest);
+ $dispatch_to =~ s/\$(\d+)\b/$captures[$1 - 1]||""/ge;
+ } else {
+ $dispatch_to .= " " . $rest;
+ }
return $dispatch_to;
}
return undef;
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list