[Bps-public-commit] SD branch, master, updated. fab3b2841bee6a0520ce75d1aaa4f29f5bb17edd

spang at bestpractical.com spang at bestpractical.com
Mon Aug 17 07:39:49 EDT 2009


The branch, master has been updated
       via  fab3b2841bee6a0520ce75d1aaa4f29f5bb17edd (commit)
      from  ba9e1e4f6f52257db25fed719c90d9a1a98bdb52 (commit)

Summary of changes:
 lib/App/SD/CLI/Command/Help.pm             |    4 ++--
 lib/App/SD/CLI/Command/Help/About.pm       |    2 +-
 lib/App/SD/CLI/Command/Help/Aliases.pm     |    2 +-
 lib/App/SD/CLI/Command/Help/Attachments.pm |    2 +-
 lib/App/SD/CLI/Command/Help/Authors.pm     |    2 +-
 lib/App/SD/CLI/Command/Help/Comments.pm    |    2 +-
 lib/App/SD/CLI/Command/Help/Config.pm      |    2 +-
 lib/App/SD/CLI/Command/Help/Environment.pm |    2 +-
 lib/App/SD/CLI/Command/Help/History.pm     |    2 +-
 lib/App/SD/CLI/Command/Help/Intro.pm       |    2 +-
 lib/App/SD/CLI/Command/Help/Search.pm      |    2 +-
 lib/App/SD/CLI/Command/Help/Settings.pm    |    2 +-
 lib/App/SD/CLI/Command/Help/Sync.pm        |    2 +-
 lib/App/SD/CLI/Command/Help/Tickets.pm     |    2 +-
 lib/App/SD/CLI/Command/Ticket/Comments.pm  |    2 +-
 lib/App/SD/CLI/Command/Ticket/Create.pm    |    2 +-
 lib/App/SD/CLI/Command/Ticket/Search.pm    |    2 +-
 lib/App/SD/CLI/Command/Ticket/Show.pm      |    2 +-
 lib/App/SD/CLI/Command/Ticket/Update.pm    |    2 +-
 lib/App/SD/CLI/Dispatcher.pm               |   12 +++---------
 20 files changed, 23 insertions(+), 29 deletions(-)

- Log -----------------------------------------------------------------
commit fab3b2841bee6a0520ce75d1aaa4f29f5bb17edd
Author: Christine Spang <spang at bestpractical.com>
Date:   Mon Aug 17 12:28:08 2009 +0100

    Don't suggest 'sd help' when in the shell
    
    Closes: CDD24854-718F-11DE-919C-DF0E2BC923CF
    
    Also, update get_cmd_name to get_script_name (changed in
    Prophet API).

diff --git a/lib/App/SD/CLI/Command/Help.pm b/lib/App/SD/CLI/Command/Help.pm
index 09fdcf0..b4441e1 100644
--- a/lib/App/SD/CLI/Command/Help.pm
+++ b/lib/App/SD/CLI/Command/Help.pm
@@ -5,7 +5,7 @@ with 'App::SD::CLI::Command';
 
 sub usage_msg {
     my $self = shift;
-    my $cmd = $self->get_cmd_name;
+    my $cmd = $self->cli->get_script_name;
 
     return <<"END_USAGE";
 usage: ${cmd}help [<topic>]
@@ -38,7 +38,7 @@ sub print_header {
 
 sub run {
     my $self = shift;
-    my ${cmd}= $self->get_cmd_name;
+    my ${cmd}= $self->cli->get_script_name;
 
     $self->print_header("Help Index");
 
diff --git a/lib/App/SD/CLI/Command/Help/About.pm b/lib/App/SD/CLI/Command/Help/About.pm
index 0bc758a..8c2450e 100644
--- a/lib/App/SD/CLI/Command/Help/About.pm
+++ b/lib/App/SD/CLI/Command/Help/About.pm
@@ -4,7 +4,7 @@ extends 'App::SD::CLI::Command::Help';
 
 sub run {
     my $self = shift;
-    my ${cmd}= $self->get_cmd_name;
+    my ${cmd}= $self->cli->get_script_name;
     $self->print_header('About SD');
 
 print <<EOF
diff --git a/lib/App/SD/CLI/Command/Help/Aliases.pm b/lib/App/SD/CLI/Command/Help/Aliases.pm
index 92f345a..308a6c5 100644
--- a/lib/App/SD/CLI/Command/Help/Aliases.pm
+++ b/lib/App/SD/CLI/Command/Help/Aliases.pm
@@ -5,7 +5,7 @@ extends 'App::SD::CLI::Command::Help';
 sub run {
     my $self = shift;
     $self->print_header('Command Aliases');
-    my ${cmd}= $self->get_cmd_name;
+    my ${cmd}= $self->cli->get_script_name;
 
 print <<EOF
 
diff --git a/lib/App/SD/CLI/Command/Help/Attachments.pm b/lib/App/SD/CLI/Command/Help/Attachments.pm
index ace4aa7..ca0cee4 100644
--- a/lib/App/SD/CLI/Command/Help/Attachments.pm
+++ b/lib/App/SD/CLI/Command/Help/Attachments.pm
@@ -5,7 +5,7 @@ extends 'App::SD::CLI::Command::Help';
 sub run {
     my $self = shift;
     $self->print_header('Working with ticket attachments');
-    my ${cmd}= $self->get_cmd_name;
+    my ${cmd}= $self->cli->get_script_name;
 
 print <<EOF
 
diff --git a/lib/App/SD/CLI/Command/Help/Authors.pm b/lib/App/SD/CLI/Command/Help/Authors.pm
index 5783f99..1841356 100644
--- a/lib/App/SD/CLI/Command/Help/Authors.pm
+++ b/lib/App/SD/CLI/Command/Help/Authors.pm
@@ -4,7 +4,7 @@ extends 'App::SD::CLI::Command::Help';
 
 sub run {
     my $self = shift;
-    my ${cmd}= $self->get_cmd_name;
+    my ${cmd}= $self->cli->get_script_name;
     $self->print_header("Authors");
 
 print <<EOF
diff --git a/lib/App/SD/CLI/Command/Help/Comments.pm b/lib/App/SD/CLI/Command/Help/Comments.pm
index 1b87434..58a33df 100644
--- a/lib/App/SD/CLI/Command/Help/Comments.pm
+++ b/lib/App/SD/CLI/Command/Help/Comments.pm
@@ -5,7 +5,7 @@ extends 'App::SD::CLI::Command::Help';
 sub run {
     my $self = shift;
     $self->print_header('Working with ticket comments');
-    my ${cmd}= $self->get_cmd_name;
+    my ${cmd}= $self->cli->get_script_name;
 
 print <<EOF
 
diff --git a/lib/App/SD/CLI/Command/Help/Config.pm b/lib/App/SD/CLI/Command/Help/Config.pm
index 9808007..8d70167 100644
--- a/lib/App/SD/CLI/Command/Help/Config.pm
+++ b/lib/App/SD/CLI/Command/Help/Config.pm
@@ -5,7 +5,7 @@ extends 'App::SD::CLI::Command::Help';
 sub run {
     my $self = shift;
     $self->print_header('Configuration Options');
-    my ${cmd}= $self->get_cmd_name;
+    my ${cmd}= $self->cli->get_script_name;
 
 print <<EOF
 SD supports a layered configuration system with three configuration
diff --git a/lib/App/SD/CLI/Command/Help/Environment.pm b/lib/App/SD/CLI/Command/Help/Environment.pm
index f8553c1..2cc4669 100644
--- a/lib/App/SD/CLI/Command/Help/Environment.pm
+++ b/lib/App/SD/CLI/Command/Help/Environment.pm
@@ -5,7 +5,7 @@ extends 'App::SD::CLI::Command::Help';
 sub run {
     my $self = shift;
     $self->print_header('Environment variables');
-    my ${cmd}= $self->get_cmd_name;
+    my ${cmd}= $self->cli->get_script_name;
 
 print <<EOF
 
diff --git a/lib/App/SD/CLI/Command/Help/History.pm b/lib/App/SD/CLI/Command/Help/History.pm
index 8b26b49..c17ea49 100644
--- a/lib/App/SD/CLI/Command/Help/History.pm
+++ b/lib/App/SD/CLI/Command/Help/History.pm
@@ -5,7 +5,7 @@ extends 'App::SD::CLI::Command::Help';
 sub run {
     my $self = shift;
     $self->print_header('Viewing Database History');
-    my ${cmd}= $self->get_cmd_name;
+    my ${cmd}= $self->cli->get_script_name;
 
 print <<EOF
 You can view a history of all changes to the database using the 'log'
diff --git a/lib/App/SD/CLI/Command/Help/Intro.pm b/lib/App/SD/CLI/Command/Help/Intro.pm
index 6b0f46f..d2a4e54 100644
--- a/lib/App/SD/CLI/Command/Help/Intro.pm
+++ b/lib/App/SD/CLI/Command/Help/Intro.pm
@@ -5,7 +5,7 @@ extends 'App::SD::CLI::Command::Help';
 sub run {
     my $self = shift;
     $self->print_header('Getting started with SD');
-    my ${cmd}= $self->get_cmd_name;
+    my ${cmd}= $self->cli->get_script_name;
 
 print <<EOF
 SD is a peer to peer ticket tracking system built on the Prophet 
diff --git a/lib/App/SD/CLI/Command/Help/Search.pm b/lib/App/SD/CLI/Command/Help/Search.pm
index 699d66d..fcff979 100644
--- a/lib/App/SD/CLI/Command/Help/Search.pm
+++ b/lib/App/SD/CLI/Command/Help/Search.pm
@@ -5,7 +5,7 @@ extends 'App::SD::CLI::Command::Help';
 sub run {
     my $self = shift;
     $self->print_header('Searching for and displaying tickets');
-    my ${cmd}= $self->get_cmd_name;
+    my ${cmd}= $self->cli->get_script_name;
 
 print <<EOF
 
diff --git a/lib/App/SD/CLI/Command/Help/Settings.pm b/lib/App/SD/CLI/Command/Help/Settings.pm
index 407b021..bf251c9 100644
--- a/lib/App/SD/CLI/Command/Help/Settings.pm
+++ b/lib/App/SD/CLI/Command/Help/Settings.pm
@@ -5,7 +5,7 @@ extends 'App::SD::CLI::Command::Help';
 sub run {
     my $self = shift;
     $self->print_header('Database Settings');
-    my ${cmd}= $self->get_cmd_name;
+    my ${cmd}= $self->cli->get_script_name;
 
 print <<EOF
 The 'settings' command allows you to modify configuration variables
diff --git a/lib/App/SD/CLI/Command/Help/Sync.pm b/lib/App/SD/CLI/Command/Help/Sync.pm
index deee7f2..0ecbf93 100644
--- a/lib/App/SD/CLI/Command/Help/Sync.pm
+++ b/lib/App/SD/CLI/Command/Help/Sync.pm
@@ -5,7 +5,7 @@ extends 'App::SD::CLI::Command::Help';
 sub run {
     my $self = shift;
     $self->print_header('Sharing ticket databases');
-    my ${cmd}= $self->get_cmd_name;
+    my ${cmd}= $self->cli->get_script_name;
 
 print <<EOF
 
diff --git a/lib/App/SD/CLI/Command/Help/Tickets.pm b/lib/App/SD/CLI/Command/Help/Tickets.pm
index a473f62..a9e7119 100644
--- a/lib/App/SD/CLI/Command/Help/Tickets.pm
+++ b/lib/App/SD/CLI/Command/Help/Tickets.pm
@@ -5,7 +5,7 @@ extends 'App::SD::CLI::Command::Help';
 sub run {
     my $self = shift;
     $self->print_header('Creating and Updating tickets');
-    my ${cmd}= $self->get_cmd_name;
+    my ${cmd}= $self->cli->get_script_name;
 
 print <<EOF
     ${cmd}ticket create
diff --git a/lib/App/SD/CLI/Command/Ticket/Comments.pm b/lib/App/SD/CLI/Command/Ticket/Comments.pm
index 7c5d5fa..d360144 100644
--- a/lib/App/SD/CLI/Command/Ticket/Comments.pm
+++ b/lib/App/SD/CLI/Command/Ticket/Comments.pm
@@ -8,7 +8,7 @@ with 'App::SD::CLI::Model::Ticket';
 
 override usage_msg => sub {
     my $self = shift;
-    my $cmd = $self->get_cmd_name;
+    my $cmd = $self->cli->get_script_name;
 
     return <<"END_USAGE";
 usage: ${cmd}ticket comments <ticket-id>
diff --git a/lib/App/SD/CLI/Command/Ticket/Create.pm b/lib/App/SD/CLI/Command/Ticket/Create.pm
index f319d7a..f45bdb0 100644
--- a/lib/App/SD/CLI/Command/Ticket/Create.pm
+++ b/lib/App/SD/CLI/Command/Ticket/Create.pm
@@ -13,7 +13,7 @@ sub ARG_TRANSLATIONS { shift->SUPER::ARG_TRANSLATIONS(),  e => 'edit'  };
 # interactive editing mode
 override usage_msg => sub {
     my $self = shift;
-    my $cmd = $self->get_cmd_name;
+    my $cmd = $self->cli->get_script_name;
 
     my @primary_commands = @{ $self->context->primary_commands };
 
diff --git a/lib/App/SD/CLI/Command/Ticket/Search.pm b/lib/App/SD/CLI/Command/Ticket/Search.pm
index 8d23afb..5cdfd54 100644
--- a/lib/App/SD/CLI/Command/Ticket/Search.pm
+++ b/lib/App/SD/CLI/Command/Ticket/Search.pm
@@ -7,7 +7,7 @@ sub ARG_TRANSLATIONS { shift->SUPER::ARG_TRANSLATIONS(),  s => 'sort', g => 'gro
 
 sub usage_msg {
     my $self = shift;
-    my $script = $self->get_cmd_name;
+    my $script = $self->cli->get_script_name;
 
     my @primary_commands = @{ $self->context->primary_commands };
 
diff --git a/lib/App/SD/CLI/Command/Ticket/Show.pm b/lib/App/SD/CLI/Command/Ticket/Show.pm
index 1a1fec2..46c3fb0 100644
--- a/lib/App/SD/CLI/Command/Ticket/Show.pm
+++ b/lib/App/SD/CLI/Command/Ticket/Show.pm
@@ -21,7 +21,7 @@ sub by_creation_date {
 sub usage_msg {
     my $self = shift;
     my $cmd = shift || 'show';
-    my $script = $self->get_cmd_name;
+    my $script = $self->cli->get_script_name;
     my $type = $self->type ? $self->type . q{ } : q{};
 
     return <<"END_USAGE";
diff --git a/lib/App/SD/CLI/Command/Ticket/Update.pm b/lib/App/SD/CLI/Command/Ticket/Update.pm
index bcdfdbb..0c970ec 100644
--- a/lib/App/SD/CLI/Command/Ticket/Update.pm
+++ b/lib/App/SD/CLI/Command/Ticket/Update.pm
@@ -11,7 +11,7 @@ sub ARG_TRANSLATIONS { shift->SUPER::ARG_TRANSLATIONS(),  a => 'all-props'  };
 
 sub usage_msg {
     my $self = shift;
-    my $cmd = $self->get_cmd_name;
+    my $cmd = $self->cli->get_script_name;
     my @primary_commands = @{ $self->context->primary_commands };
 
     # if primary commands was only length 1, the type was not specified
diff --git a/lib/App/SD/CLI/Dispatcher.pm b/lib/App/SD/CLI/Dispatcher.pm
index c11ab46..a651c2d 100644
--- a/lib/App/SD/CLI/Dispatcher.pm
+++ b/lib/App/SD/CLI/Dispatcher.pm
@@ -77,7 +77,7 @@ on qr'.*' => sub {
 
         exit 1;
     }
-	next_rule;
+    next_rule;
 };
 
 on qr'.*' => sub {
@@ -207,19 +207,13 @@ on '' => run_command('Shell');
 on qr/^(.*)$/ => sub {
    my $self = shift;
    my $command = $1;
-   die "The command you ran, '$command', could not be found. Perhaps running '"._format_cmd_name('help')."' would help?\n";
+   die "The command you ran, '$command', could not be found. Perhaps running '"
+        .$self->cli->get_script_name."help' would help?\n";
 
 };
 
 sub run_command { Prophet::CLI::Dispatcher::run_command(@_) }
 
-
-sub _format_cmd_name {
-    my $cmd = shift;
-    return basename($0) . " ". $cmd;
-
-}
-
 __PACKAGE__->meta->make_immutable;
 no Any::Moose;
 

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list