[Bps-public-commit] Prophet branch, master, updated. 0.69_01-38-g3b296ea
sunnavy at bestpractical.com
sunnavy at bestpractical.com
Thu Sep 3 05:45:02 EDT 2009
The branch, master has been updated
via 3b296ead8020905b92da059bdbf98b1e2eea4301 (commit)
from d5183ccadd654876362d19a490095fd7edd62cc0 (commit)
Summary of changes:
lib/Prophet/CLI.pm | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
- Log -----------------------------------------------------------------
commit 3b296ead8020905b92da059bdbf98b1e2eea4301
Author: sunnavy <sunnavy at bestpractical.com>
Date: Thu Sep 3 17:44:56 2009 +0800
more notes to the long and ugly alias value stuff parser
diff --git a/lib/Prophet/CLI.pm b/lib/Prophet/CLI.pm
index bcdb08c..e371faf 100644
--- a/lib/Prophet/CLI.pm
+++ b/lib/Prophet/CLI.pm
@@ -103,6 +103,14 @@ sub run_one_command {
my @args;
# parse command string to @args
+ # e.g. "ticket search --regex='foo bar'" should be parsed to
+ # ['ticket', 'search', '--regex=foo bar']
+ # "ticket search --regex 'foo bar'" should be parsed to
+ # ['ticket', 'search', '--regex', 'foo bar']
+
+ # TODO the following parse stuff is ugly,
+ # but I haven't found a better way.
+ # may the force be with you
{
my $text = $command;
$text =~ s/^\s+//g;
@@ -123,6 +131,7 @@ sub run_one_command {
$need_balance{single}++ while $extracted =~ /(?<!\\)'/g;
$need_balance{double}++ while $extracted =~ /(?<!\\)"/g;
+ # search $reminder to make $extracted balanced.
while ($need_balance{single} % 2
|| $need_balance{double} % 2 )
{
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list