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

spang at bestpractical.com spang at bestpractical.com
Wed Aug 5 11:26:47 EDT 2009


The branch, master has been updated
       via  dfb47f3098dc47a228620df53398dafa1be87c71 (commit)
       via  d2c018dc60d3c7de12a3684527fda1dd6d13d97f (commit)
       via  d5025c4568b8f683f50d6d894193c3122a0e73b0 (commit)
       via  8092592607b0927aaa31ab96847efbfcbd083936 (commit)
       via  3893c4689a0cb9b2219400a7d790eb37b1bf5812 (commit)
      from  75b907550fcabf9e803ce4459fe17853e040360a (commit)

Summary of changes:
 lib/App/SD/CLI/Command/Attachment/Content.pm       |    3 ++
 lib/App/SD/CLI/Command/Attachment/Create.pm        |    2 +
 lib/App/SD/CLI/Command/Help.pm                     |   22 ++++++++++--------
 lib/App/SD/CLI/Command/Help/About.pm               |    2 +-
 lib/App/SD/CLI/Command/Help/Aliases.pm             |    6 ++--
 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                |    4 +-
 lib/App/SD/CLI/Command/Help/Tickets.pm             |    2 +-
 lib/App/SD/CLI/Command/Ticket/Attachment/Create.pm |   12 ++++++++++
 lib/App/SD/CLI/Command/Ticket/Attachment/Search.pm |    3 +-
 lib/App/SD/CLI/Command/Ticket/Comment/Create.pm    |   13 +++++++++++
 lib/App/SD/CLI/Command/Ticket/Comment/Update.pm    |    3 ++
 lib/App/SD/CLI/Command/Ticket/Comments.pm          |   10 ++++++++
 lib/App/SD/CLI/Command/Ticket/Create.pm            |   23 ++++++++++++++++++++
 lib/App/SD/CLI/Command/Ticket/Details.pm           |   16 +++++++++++++
 lib/App/SD/CLI/Command/Ticket/Search.pm            |   20 +++++++++++++++++
 lib/App/SD/CLI/Command/Ticket/Show.pm              |   17 ++++++++++++++
 lib/App/SD/CLI/Command/Ticket/Update.pm            |   19 ++++++++++++++++
 26 files changed, 167 insertions(+), 28 deletions(-)

- Log -----------------------------------------------------------------
commit 3893c4689a0cb9b2219400a7d790eb37b1bf5812
Author: Christine Spang <spang at bestpractical.com>
Date:   Wed Jul 22 11:37:44 2009 +0100

    A couple tweaks to aliases help.
    
    One is more pronounceable, the second is less error-prone. (Syntax
    in the help should be the recommended syntax.)

diff --git a/lib/App/SD/CLI/Command/Help/Aliases.pm b/lib/App/SD/CLI/Command/Help/Aliases.pm
index 0cca740..04a611e 100644
--- a/lib/App/SD/CLI/Command/Help/Aliases.pm
+++ b/lib/App/SD/CLI/Command/Help/Aliases.pm
@@ -42,10 +42,10 @@ and vice-versa):
     ${cmd}aliases edit
       Edit aliases in an editor window.
 
-    ${cmd}aliases "command to type" "command to translate to"
+    ${cmd}alias "command to type" "command to translate to"
       Set the given alias (or change it if it already exists).
 
-    ${cmd}aliases delete command to type
+    ${cmd}aliases delete "command to type"
       Delete the given alias.
 
 The --user and --global arguments can be used in conjunction with the

commit 8092592607b0927aaa31ab96847efbfcbd083936
Author: Christine Spang <spang at bestpractical.com>
Date:   Wed Jul 22 16:48:11 2009 +0100

    _get_cmd_name got moved to Prophet::Command

diff --git a/lib/App/SD/CLI/Command/Help.pm b/lib/App/SD/CLI/Command/Help.pm
index 8d82889..e70585e 100644
--- a/lib/App/SD/CLI/Command/Help.pm
+++ b/lib/App/SD/CLI/Command/Help.pm
@@ -8,14 +8,6 @@ sub title {
 
 }
 
-sub _get_cmd_name {
-    my $self = shift;
-    return '' if $self->cli->interactive_shell;
-    my ${cmd}= $0;
-    ${cmd}=~ s{^(.*)/}{}g;
-    return $cmd.' ';
-}
-
 sub version {
     my $self = shift;
     "sd ".$App::SD::VERSION;
@@ -36,7 +28,7 @@ sub print_header {
 
 sub run {
     my $self = shift;
-    my ${cmd}= $self->_get_cmd_name;
+    my ${cmd}= $self->get_cmd_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 b1d52d1..0bc758a 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->get_cmd_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 04a611e..92f345a 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->get_cmd_name;
 
 print <<EOF
 
diff --git a/lib/App/SD/CLI/Command/Help/Attachments.pm b/lib/App/SD/CLI/Command/Help/Attachments.pm
index 6abade9..ace4aa7 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->get_cmd_name;
 
 print <<EOF
 
diff --git a/lib/App/SD/CLI/Command/Help/Authors.pm b/lib/App/SD/CLI/Command/Help/Authors.pm
index a56bcd7..5783f99 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->get_cmd_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 076fac1..1b87434 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->get_cmd_name;
 
 print <<EOF
 
diff --git a/lib/App/SD/CLI/Command/Help/Config.pm b/lib/App/SD/CLI/Command/Help/Config.pm
index dfeebb8..5201cf9 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->get_cmd_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 5ba214c..f8553c1 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->get_cmd_name;
 
 print <<EOF
 
diff --git a/lib/App/SD/CLI/Command/Help/History.pm b/lib/App/SD/CLI/Command/Help/History.pm
index f4af993..8b26b49 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->get_cmd_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 e904773..a5c74df 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->get_cmd_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 08ee688..699d66d 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->get_cmd_name;
 
 print <<EOF
 
diff --git a/lib/App/SD/CLI/Command/Help/Settings.pm b/lib/App/SD/CLI/Command/Help/Settings.pm
index 84e55e1..33d109e 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->get_cmd_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 68c279a..f8e8843 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->get_cmd_name;
 
 print <<EOF
 
diff --git a/lib/App/SD/CLI/Command/Help/Tickets.pm b/lib/App/SD/CLI/Command/Help/Tickets.pm
index 489fde2..a473f62 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->get_cmd_name;
 
 print <<EOF
     ${cmd}ticket create

commit d5025c4568b8f683f50d6d894193c3122a0e73b0
Author: Christine Spang <spang at bestpractical.com>
Date:   Wed Jul 22 17:42:14 2009 +0100

    First pass at usage messages.

diff --git a/lib/App/SD/CLI/Command/Attachment/Content.pm b/lib/App/SD/CLI/Command/Attachment/Content.pm
index 4d81484..e07b3d8 100644
--- a/lib/App/SD/CLI/Command/Attachment/Content.pm
+++ b/lib/App/SD/CLI/Command/Attachment/Content.pm
@@ -6,6 +6,9 @@ with 'App::SD::CLI::Command';
 
 sub run {
     my $self = shift;
+
+    $self->print_usage if $self->has_arg('h');
+
     my $record =  $self->_get_record_object;
     $record->load(uuid => $self->uuid);
     print $record->prop('content');
diff --git a/lib/App/SD/CLI/Command/Attachment/Create.pm b/lib/App/SD/CLI/Command/Attachment/Create.pm
index fc4cd0e..52c8f88 100644
--- a/lib/App/SD/CLI/Command/Attachment/Create.pm
+++ b/lib/App/SD/CLI/Command/Attachment/Create.pm
@@ -7,6 +7,8 @@ with 'App::SD::CLI::Command';
 sub run {
     my $self = shift;
 
+    $self->print_usage if $self->has_arg('h');
+
     my $content = $self->get_content(type => 'attachment');
 
     die "Aborted.\n"
diff --git a/lib/App/SD/CLI/Command/Help.pm b/lib/App/SD/CLI/Command/Help.pm
index e70585e..faaf1eb 100644
--- a/lib/App/SD/CLI/Command/Help.pm
+++ b/lib/App/SD/CLI/Command/Help.pm
@@ -3,6 +3,15 @@ use Any::Moose;
 extends 'Prophet::CLI::Command';
 with 'App::SD::CLI::Command';
 
+sub usage_msg {
+    my $self = shift;
+    my $cmd = $self->get_cmd_name;
+
+    return <<"END_USAGE";
+usage: ${cmd}help [<topic>]
+END_USAGE
+}
+
 sub title {
     my $self = shift;
 
@@ -18,8 +27,9 @@ sub print_header {
     my $self = shift;
     my $title = shift;
     my $string =  join(' - ', $self->version, $title);
-    
-    
+
+    $self->print_usage if $self->has_arg('h');
+
     print "\n".$string . "\n";
     print '-' x ( length($string));
     print "\n";
diff --git a/lib/App/SD/CLI/Command/Ticket/Attachment/Create.pm b/lib/App/SD/CLI/Command/Ticket/Attachment/Create.pm
index eb962ab..7f4a5e7 100644
--- a/lib/App/SD/CLI/Command/Ticket/Attachment/Create.pm
+++ b/lib/App/SD/CLI/Command/Ticket/Attachment/Create.pm
@@ -4,9 +4,21 @@ extends 'App::SD::CLI::Command::Attachment::Create';
 
 sub ARG_TRANSLATIONS { shift->SUPER::ARG_TRANSLATIONS(),  f => 'file'  };
 
+sub usage_msg {
+    my $self = shift;
+    my ($cmd, $type_and_subcmd) = $self->get_cmd_and_subcmd_names;
+
+    return <<"END_USAGE";
+usage: ${cmd}${type_and_subcmd} <record-id> [--file <filename>]
+END_USAGE
+}
+
 # override args to feed in that ticket's uuid as an argument to the comment
 sub run {
     my $self = shift;
+
+    $self->print_usage if $self->has_arg('h');
+
     $self->require_uuid;
 
     $self->set_prop(ticket => $self->uuid);
diff --git a/lib/App/SD/CLI/Command/Ticket/Attachment/Search.pm b/lib/App/SD/CLI/Command/Ticket/Attachment/Search.pm
index 974c6f3..892661a 100644
--- a/lib/App/SD/CLI/Command/Ticket/Attachment/Search.pm
+++ b/lib/App/SD/CLI/Command/Ticket/Attachment/Search.pm
@@ -3,10 +3,9 @@ use Any::Moose;
 extends 'Prophet::CLI::Command::Search';
 with 'Prophet::CLI::RecordCommand';
 with 'App::SD::CLI::Model::Attachment';
-# override args to feed in that ticket's uuid as an argument to the comment
-
 
 sub type {'attachment'}
+
 sub get_search_callback {
     my $self = shift;
     return sub {
diff --git a/lib/App/SD/CLI/Command/Ticket/Comment/Create.pm b/lib/App/SD/CLI/Command/Ticket/Comment/Create.pm
index fa0be02..403af1c 100644
--- a/lib/App/SD/CLI/Command/Ticket/Comment/Create.pm
+++ b/lib/App/SD/CLI/Command/Ticket/Comment/Create.pm
@@ -7,9 +7,22 @@ with 'App::SD::CLI::Command';
 
 sub ARG_TRANSLATIONS { shift->SUPER::ARG_TRANSLATIONS(),  f => 'file', m => 'content'  };
 
+sub usage_msg {
+    my $self = shift;
+    my ($cmd, $type_and_subcmd) = $self->get_cmd_and_subcmd_names;
+
+    return <<"END_USAGE";
+usage: ${cmd}${type_and_subcmd} <ticket-id> [--edit]
+       ${cmd}${type_and_subcmd} <ticket-id> -- content="message here"
+END_USAGE
+}
+
 # override args to feed in that ticket's uuid as an argument to the comment
 sub run {
     my $self = shift;
+
+    $self->print_usage if $self->has_arg('h');
+
     $self->require_uuid;
 
     my $content = $self->get_content(type => 'comment', default_edit => 1);
diff --git a/lib/App/SD/CLI/Command/Ticket/Comment/Update.pm b/lib/App/SD/CLI/Command/Ticket/Comment/Update.pm
index 8f529f0..8ac04dd 100644
--- a/lib/App/SD/CLI/Command/Ticket/Comment/Update.pm
+++ b/lib/App/SD/CLI/Command/Ticket/Comment/Update.pm
@@ -5,6 +5,9 @@ extends 'Prophet::CLI::Command::Update';
 
 override run => sub {
     my $self = shift;
+
+    $self->print_usage if $self->has_arg('h');
+
     $self->require_uuid;
 
     my $record = $self->_load_record;
diff --git a/lib/App/SD/CLI/Command/Ticket/Comments.pm b/lib/App/SD/CLI/Command/Ticket/Comments.pm
index 9b47ee1..be658c5 100644
--- a/lib/App/SD/CLI/Command/Ticket/Comments.pm
+++ b/lib/App/SD/CLI/Command/Ticket/Comments.pm
@@ -6,6 +6,16 @@ with 'Prophet::CLI::RecordCommand';
 with 'App::SD::CLI::Command';
 with 'App::SD::CLI::Model::Ticket';
 
+override usage_msg => sub {
+    my $self = shift;
+    my $cmd = $self->get_cmd_name;
+
+    return <<"END_USAGE";
+usage: ${cmd}ticket comments <ticket-id>
+
+END_USAGE
+};
+
 sub run {
     my $self = shift;
     my $record = $self->_get_record_object;
diff --git a/lib/App/SD/CLI/Command/Ticket/Create.pm b/lib/App/SD/CLI/Command/Ticket/Create.pm
index 5a0972f..f319d7a 100644
--- a/lib/App/SD/CLI/Command/Ticket/Create.pm
+++ b/lib/App/SD/CLI/Command/Ticket/Create.pm
@@ -9,11 +9,34 @@ with 'Prophet::CLI::TextEditorCommand';
 
 sub ARG_TRANSLATIONS { shift->SUPER::ARG_TRANSLATIONS(),  e => 'edit'  };
 
+# use actual valid ticket props in the help message, and make note of the
+# interactive editing mode
+override usage_msg => sub {
+    my $self = shift;
+    my $cmd = $self->get_cmd_name;
+
+    my @primary_commands = @{ $self->context->primary_commands };
+
+    # if primary commands was only length 1, the type was not specified
+    # and we should indicate that a type is expected
+    push @primary_commands, '<record-type>' if @primary_commands == 1;
+
+    my $type_and_subcmd = join( q{ }, @primary_commands );
+
+    return <<"END_USAGE";
+usage: ${cmd}${type_and_subcmd} -- summary=foo status=open
+       ${cmd}${type_and_subcmd} [--edit]
+END_USAGE
+};
+
 # we want to launch an $EDITOR window to grab props and a comment if no
 # props are specified on the commandline
 
 override run => sub {
     my $self = shift;
+
+    $self->print_usage if $self->has_arg('h');
+
     my @prop_set = $self->prop_set;
     my $record = $self->_get_record_object;
 
diff --git a/lib/App/SD/CLI/Command/Ticket/Details.pm b/lib/App/SD/CLI/Command/Ticket/Details.pm
index 60e96b1..2451cb2 100644
--- a/lib/App/SD/CLI/Command/Ticket/Details.pm
+++ b/lib/App/SD/CLI/Command/Ticket/Details.pm
@@ -4,9 +4,25 @@ extends 'App::SD::CLI::Command::Ticket::Show';
 
 sub by_creation_date { $a->prop('created') cmp $b->prop('created') };
 
+sub usage_msg {
+    my $self = shift;
+    my ($cmd, $type_and_subcmd) = $self->get_cmd_and_subcmd_names;
+
+    # XXX TODO Review these options
+    return <<"END_USAGE";
+usage: ${script}${type_and_subcmd} <record-id> [options]
+
+Options are:
+    -a|--all-props      Show props even if they aren't common
+    -b|--batch
+END_USAGE
+}
+
 override run => sub {
     my $self = shift;
 
+    $self->print_usage if $self->has_arg('h');
+
     $self->require_uuid;
     my $record = $self->_load_record;
 
diff --git a/lib/App/SD/CLI/Command/Ticket/Search.pm b/lib/App/SD/CLI/Command/Ticket/Search.pm
index c74fd95..8d23afb 100644
--- a/lib/App/SD/CLI/Command/Ticket/Search.pm
+++ b/lib/App/SD/CLI/Command/Ticket/Search.pm
@@ -5,10 +5,30 @@ with 'App::SD::CLI::Command';
 
 sub ARG_TRANSLATIONS { shift->SUPER::ARG_TRANSLATIONS(),  s => 'sort', g => 'group'  };
 
+sub usage_msg {
+    my $self = shift;
+    my $script = $self->get_cmd_name;
+
+    my @primary_commands = @{ $self->context->primary_commands };
+
+    # if primary commands was only length 1, the type was not specified
+    # and we should indicate that a type is expected
+    push @primary_commands, '<record-type>' if @primary_commands <= 1;
+
+    my $type_and_subcmd = join( q{ }, @primary_commands );
+
+    return <<"END_USAGE";
+usage: ${script}${type_and_subcmd}
+       ${script}${type_and_subcmd} -- summary=~foo status!~new|open
+END_USAGE
+}
+
 # frob the sort routine before running prophet's search command
 sub run {
     my $self = shift;
 
+    $self->print_usage if $self->has_arg('h');
+
     if (  (!$self->has_arg('sort') || !$self->arg('sort'))
         && $self->app_handle->config->get( key => 'ticket.default-sort') )
     {
diff --git a/lib/App/SD/CLI/Command/Ticket/Show.pm b/lib/App/SD/CLI/Command/Ticket/Show.pm
index 03691e2..1a1fec2 100644
--- a/lib/App/SD/CLI/Command/Ticket/Show.pm
+++ b/lib/App/SD/CLI/Command/Ticket/Show.pm
@@ -16,13 +16,30 @@ sub by_creation_date {
     ($a->can('created') ? $a->created : $a->prop('created') )
     cmp 
     ($b->can('created') ? $b->created : $b->prop('created') )
+}
 
-
+sub usage_msg {
+    my $self = shift;
+    my $cmd = shift || 'show';
+    my $script = $self->get_cmd_name;
+    my $type = $self->type ? $self->type . q{ } : q{};
+
+    return <<"END_USAGE";
+usage: ${script}${type}${cmd} <record-id> [options]
+
+Options are:
+    -a|--all-props      Show props even if they aren't common
+    -s|--skip-history   Don't show ticket history
+    -h|--with-history   Show ticket history even if disabled in config
+    -b|--batch
+END_USAGE
 }
 
 override run => sub {
     my $self = shift;
 
+    $self->print_usage if $self->has_arg('h');
+
     $self->require_uuid;
     my $record = $self->_load_record;
 
diff --git a/lib/App/SD/CLI/Command/Ticket/Update.pm b/lib/App/SD/CLI/Command/Ticket/Update.pm
index 479976b..bcdfdbb 100644
--- a/lib/App/SD/CLI/Command/Ticket/Update.pm
+++ b/lib/App/SD/CLI/Command/Ticket/Update.pm
@@ -9,11 +9,30 @@ with 'Prophet::CLI::TextEditorCommand';
 
 sub ARG_TRANSLATIONS { shift->SUPER::ARG_TRANSLATIONS(),  a => 'all-props'  };
 
+sub usage_msg {
+    my $self = shift;
+    my $cmd = $self->get_cmd_name;
+    my @primary_commands = @{ $self->context->primary_commands };
+
+    # if primary commands was only length 1, the type was not specified
+    # and we should indicate that a type is expected
+    push @primary_commands, '<record-type>' if @primary_commands <= 1;
+
+    my $type_and_subcmd = join( q{ }, @primary_commands );
+
+    return <<"END_USAGE";
+usage: ${cmd}${type_and_subcmd} <record-id> --edit [--all-props]
+       ${cmd}${type_and_subcmd} <record-id> -- status=open
+END_USAGE
+}
+
 # use an editor to edit if no props are specified on the commandline,
 # allowing the creation of a new comment in the process
 override run => sub {
     my $self = shift;
 
+    $self->print_usage if $self->has_arg('h');
+
     $self->require_uuid;
     my $record = $self->_load_record;
 

commit d2c018dc60d3c7de12a3684527fda1dd6d13d97f
Author: Christine Spang <spang at bestpractical.com>
Date:   Wed Aug 5 15:32:53 2009 +0100

    Fix typo in help index.

diff --git a/lib/App/SD/CLI/Command/Help.pm b/lib/App/SD/CLI/Command/Help.pm
index faaf1eb..09fdcf0 100644
--- a/lib/App/SD/CLI/Command/Help.pm
+++ b/lib/App/SD/CLI/Command/Help.pm
@@ -54,7 +54,7 @@ ${cmd}help sync        -  Publishing and importing ticket databases
 ${cmd}help history     -  Viewing repository history
 ${cmd}help environment -  Environment variables which affect sd
 ${cmd}help config      -  Local configuration variables
-${cmd}help ticket.summary_format  -  Details of this config variable
+${cmd}help ticket_summary_format  -  Details of this config variable
 ${cmd}help aliases     -  Command aliases
 ${cmd}help settings    -  Database configuration variables
 

commit dfb47f3098dc47a228620df53398dafa1be87c71
Author: Christine Spang <spang at bestpractical.com>
Date:   Wed Aug 5 15:34:51 2009 +0100

    GitHib -> GitHub typo in help

diff --git a/lib/App/SD/CLI/Command/Help/Sync.pm b/lib/App/SD/CLI/Command/Help/Sync.pm
index f8e8843..deee7f2 100644
--- a/lib/App/SD/CLI/Command/Help/Sync.pm
+++ b/lib/App/SD/CLI/Command/Help/Sync.pm
@@ -54,7 +54,7 @@ are foreign replica types for:
     Hiveminder (http://hiveminder.com/)
     Trac (http://trac.edgewall.com)
     Google Code (http://code.google.com)
-    GitHib (http://github.com). 
+    GitHub (http://github.com). 
 
 Read-only support is available for:
 

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



More information about the Bps-public-commit mailing list