[Bps-public-commit] SD branch, master, updated. 4e1d982122c0c0fc9a036d2a191f86225ce55d9e
jesse
jesse at bestpractical.com
Sun Jul 19 15:52:24 EDT 2009
The branch, master has been updated
via 4e1d982122c0c0fc9a036d2a191f86225ce55d9e (commit)
via e0d4f670b42e5bfb2e13a3631af3359977ab4652 (commit)
from d3f6758b9c0807b726b1572adc2c319b3be08c91 (commit)
Summary of changes:
lib/App/SD/CLI/Dispatcher.pm | 13 ++++++++++---
1 files changed, 10 insertions(+), 3 deletions(-)
- Log -----------------------------------------------------------------
commit e0d4f670b42e5bfb2e13a3631af3359977ab4652
Author: Jesse Vincent <jesse at bestpractical.com>
Date: Sun Jul 19 12:45:12 2009 -0700
Clean up how we print inline help in the dispatcher
diff --git a/lib/App/SD/CLI/Dispatcher.pm b/lib/App/SD/CLI/Dispatcher.pm
index 9f59a29..3306313 100644
--- a/lib/App/SD/CLI/Dispatcher.pm
+++ b/lib/App/SD/CLI/Dispatcher.pm
@@ -3,6 +3,7 @@ package App::SD::CLI::Dispatcher;
use Prophet::CLI::Dispatcher -base;
use Any::Moose;
require Prophet::CLIContext;
+use File::Basename;
Prophet::CLI::Dispatcher->add_command_prefix('App::SD::CLI::Command');
@@ -54,7 +55,7 @@ under help => sub {
on qr/^(\S+)$/ => sub {
my $self = shift;
my $topic = $1;
- die "Cannot find help on topic '$topic'. Try '$0 help'?\n";
+ die "Cannot find help on topic '$topic'. Try '"._format_cmd_name('help')."'?\n";
};
};
@@ -67,7 +68,7 @@ on qr'.*' => sub {
next_rule if $self->cli->app_handle->handle->replica_exists;
print join("\n","No SD database was found at " . $self->cli->app_handle->handle->url(),
- qq{Type "$0 help init" or "$0 help environment" for tips on how to sort that out.});
+ qq{Type "} . _format_cmd_name('help init'). qq{" or "} . _format_cmd_name(' help environment').qq{ for tips on how to sort that out.});
exit 1;
};
@@ -187,13 +188,19 @@ 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 '$0 help' would help?\n";
+ die "The command you ran, '$command', could not be found. Perhaps running '"._format_cmd_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;
commit 4e1d982122c0c0fc9a036d2a191f86225ce55d9e
Merge: e0d4f67... d3f6758...
Author: Jesse Vincent <jesse at bestpractical.com>
Date: Sun Jul 19 12:52:18 2009 -0700
Merge branch 'master' of fsck.com:/git/sd
* 'master' of fsck.com:/git/sd:
some doc for friendly names
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list