[Bps-public-commit] r15056 - in sd/trunk: . lib/App/SD/CLI/Command/Help
jesse at bestpractical.com
jesse at bestpractical.com
Tue Aug 12 07:26:03 EDT 2008
Author: jesse
Date: Tue Aug 12 07:26:02 2008
New Revision: 15056
Added:
sd/trunk/lib/App/SD/CLI/Command/Help/
sd/trunk/lib/App/SD/CLI/Command/Help/Attachments.pm
sd/trunk/lib/App/SD/CLI/Command/Help/Comments.pm
sd/trunk/lib/App/SD/CLI/Command/Help/Environment.pm
sd/trunk/lib/App/SD/CLI/Command/Help/Search.pm
sd/trunk/lib/App/SD/CLI/Command/Help/Sync.pm
sd/trunk/lib/App/SD/CLI/Command/Help/Tickets.pm
Modified:
sd/trunk/ (props changed)
sd/trunk/lib/App/SD/CLI/Command/Help.pm
Log:
r43083 at PC0169 (orig r15052): jesse | 2008-08-12 12:22:20 +0100
r43038 at PC0169: jesse | 2008-08-12 00:12:45 +0100
* Added more sd command help, refactored to some help subclasses
Modified: sd/trunk/lib/App/SD/CLI/Command/Help.pm
==============================================================================
--- sd/trunk/lib/App/SD/CLI/Command/Help.pm (original)
+++ sd/trunk/lib/App/SD/CLI/Command/Help.pm Tue Aug 12 07:26:02 2008
@@ -3,112 +3,45 @@
extends 'Prophet::CLI::Command';
with 'App::SD::CLI::Command';
-sub run {
+sub title {
+ my $self = shift;
+
+}
+sub _get_cmd_name {
+ my $self = shift;
my $cmd = $0;
$cmd =~ s{^(.*)/}{}g;
+return $cmd;
+}
-print <<EOF
-sd @{[$App::SD::VERSION]}
-= Searching for and displaying tickets
-
- $cmd ticket search
- Lists all tickets with a status that does not match 'closed'
-
- $cmd ticket search --regex abc
- Lists all tickets with content matching 'abc'
-
- $cmd ticket search -- status!=closed summary =~ http
- Lists all tickets with a status that does match closed
- and a summary matching 'http'
-
- $cmd ticket show 1234
- Show basic information for the ticket with local id 1234
-
- $cmd ticket details 1234
- Show basic information and history for the ticket with local id 1234
-
- $cmd ticket history 1234
- Show history for the ticket with local id 1234
-
- $cmd ticket delete 1234
- Deletes ticket with local id 1234
-
-
-= Working with tickets
-
- $cmd ticket create
- Invokes a text editor with a ticket creation template
-
- $cmd ticket create --summary="This is a summary" status=open
- Create a new ticket non-interactively
-
- $cmd ticket update 123 -- status=closed
- Sets the status of the ticket with local id 123 to closed
-
- $cmd ticket update fad5849a-67f1-11dd-bde1-5b33d3ff2799 -- status=closed
- Sets the status of the ticket with uuid
- fad5849a-67f1-11dd-bde1-5b33d3ff2799 to closed
-
-
-== Working with ticket comments
-
- $cmd ticket comment 456
- Add a comment to the ticket with id 456, popping up a text editor
-
- $cmd ticket comment 456 --file=myfile
- Add a comment to the ticket with id 456, using the content of 'myfile'
-
- $cmd ticket comment list
- List all ticket comments
-
- $cmd ticket comment show 4
- Show ticket comment 4 and all metadata
-
-
-== Working with ticket attachments
-
- $cmd ticket attachment create 456 --file bugfix.patch
- Create a new attachment on this ticket from the file 'bugfix.patch'.
-
- $cmd ticket attachment list 456
- Show all attachemnts on ticket 456
-
- $cmd ticket attachment content 567
- Send the content of attachment 567 to STDOUT
-
- $cmd ticket resolve 123
- Sets the status of the ticket with local id 123 to closed
-
-
-= Sharing ticket databases
-
- $cmd pull --from http://example.com/path/to/sd
- Integrate changes from a published SD replica over http, ftp or
- file URL schemes.
-
- $cmd pull --all
- Integrate changes from all replicas this replica has pulled from
- before
-
- $cmd pull --local
- Integrate changes from all replicas currently announcing themselves
- on the local network using Bonjour
-
- $cmd publish --to jesse\@server:path/to/destination
- Publish a copy of this replica to a remote server using rsync over
- ssh.
-
- $cmd publish --html --replica --to jesse\@server:path/to/destination
- Publish a copy of this replica, including a static html representation,
- to a remote server using rsync over ssh.
+sub print_header {
+ my $self = shift;
+ my $title = shift;
+ my $string = "sd ".$App::SD::VERSION." - " .$title;
+
+ print "\n".$string . "\n";
+ print '-' x ( length($string));
+ print "\n";
+
+}
+
+sub run {
+ my $self = shift;
+ my $cmd = $self->_get_cmd_name;
-
-= ENVIRONMENT
+ $self->print_header("Help Index");
+
+
+print <<EOF
- export SD_REPO=/path/to/sd/replica
- Specify where the ticket database SD is using should reside
+$cmd help search - Searching for and displaying tickets
+$cmd help tickets - Working with tickets
+$cmd help comments - Working with ticket comments
+$cmd help attachments - Working with ticket attachments
+$cmd help sync - Publishing and importing ticket databases
+$cmd help environment - Environment variables which affect sd
EOF
Added: sd/trunk/lib/App/SD/CLI/Command/Help/Attachments.pm
==============================================================================
--- (empty file)
+++ sd/trunk/lib/App/SD/CLI/Command/Help/Attachments.pm Tue Aug 12 07:26:02 2008
@@ -0,0 +1,29 @@
+package App::SD::CLI::Command::Help::Attachments;
+use Moose;
+extends 'App::SD::CLI::Command::Help';
+
+sub run {
+ my $self = shift;
+ $self->print_header('Working with ticket attachments');
+ my $cmd = $self->_get_cmd_name;
+
+print <<EOF
+== Working with ticket attachments
+
+ $cmd ticket attachment create 456 --file bugfix.patch
+ Create a new attachment on this ticket from the file 'bugfix.patch'.
+
+ $cmd ticket attachment list 456
+ Show all attachemnts on ticket 456
+
+ $cmd ticket attachment content 567
+ Send the content of attachment 567 to STDOUT
+EOF
+
+}
+
+__PACKAGE__->meta->make_immutable;
+no Moose;
+
+1;
+
Added: sd/trunk/lib/App/SD/CLI/Command/Help/Comments.pm
==============================================================================
--- (empty file)
+++ sd/trunk/lib/App/SD/CLI/Command/Help/Comments.pm Tue Aug 12 07:26:02 2008
@@ -0,0 +1,30 @@
+package App::SD::CLI::Command::Help::Comments;
+use Moose;
+extends 'App::SD::CLI::Command::Help';
+
+sub run {
+ my $self = shift;
+ $self->print_header('Working with ticket comments');
+ my $cmd = $self->_get_cmd_name;
+
+print <<EOF
+ $cmd ticket comment 456
+ Add a comment to the ticket with id 456, popping up a text editor
+
+ $cmd ticket comment 456 --file=myfile
+ Add a comment to the ticket with id 456, using the content of 'myfile'
+
+ $cmd ticket comment list
+ List all ticket comments
+
+ $cmd ticket comment show 4
+ Show ticket comment 4 and all metadata
+EOF
+
+}
+
+__PACKAGE__->meta->make_immutable;
+no Moose;
+
+1;
+
Added: sd/trunk/lib/App/SD/CLI/Command/Help/Environment.pm
==============================================================================
--- (empty file)
+++ sd/trunk/lib/App/SD/CLI/Command/Help/Environment.pm Tue Aug 12 07:26:02 2008
@@ -0,0 +1,20 @@
+package App::SD::CLI::Command::Help::Environment;
+use Moose;
+extends 'App::SD::CLI::Command::Help';
+
+sub run {
+ my $self = shift;
+ $self->print_header('Environment variables');
+
+print <<EOF
+ export SD_REPO=/path/to/sd/replica
+ Specify where the ticket database SD is using should reside
+EOF
+
+}
+
+__PACKAGE__->meta->make_immutable;
+no Moose;
+
+1;
+
Added: sd/trunk/lib/App/SD/CLI/Command/Help/Search.pm
==============================================================================
--- (empty file)
+++ sd/trunk/lib/App/SD/CLI/Command/Help/Search.pm Tue Aug 12 07:26:02 2008
@@ -0,0 +1,116 @@
+package App::SD::CLI::Command::Help::Search;
+use Moose;
+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;
+
+print <<EOF
+ $cmd ticket search
+ Lists all tickets with a status that does not match 'closed'
+
+ $cmd ticket search --regex abc
+ Lists all tickets with content matching 'abc'
+
+ $cmd ticket search -- status!=closed summary =~ http
+ Lists all tickets with a status that does match closed
+ and a summary matching 'http'
+
+ $cmd ticket show 1234
+ Show basic information for the ticket with local id 1234
+
+ $cmd ticket details 1234
+ Show basic information and history for the ticket with local id 1234
+
+ $cmd ticket history 1234
+ Show history for the ticket with local id 1234
+
+ $cmd ticket delete 1234
+ Deletes ticket with local id 1234
+
+
+= Working with tickets
+
+ $cmd ticket create
+ Invokes a text editor with a ticket creation template
+
+ $cmd ticket create --summary="This is a summary" status=open
+ Create a new ticket non-interactively
+
+ $cmd ticket update 123 -- status=closed
+ Sets the status of the ticket with local id 123 to closed
+
+ $cmd ticket update fad5849a-67f1-11dd-bde1-5b33d3ff2799 -- status=closed
+ Sets the status of the ticket with uuid
+ fad5849a-67f1-11dd-bde1-5b33d3ff2799 to closed
+
+
+== Working with ticket comments
+
+ $cmd ticket comment 456
+ Add a comment to the ticket with id 456, popping up a text editor
+
+ $cmd ticket comment 456 --file=myfile
+ Add a comment to the ticket with id 456, using the content of 'myfile'
+
+ $cmd ticket comment list
+ List all ticket comments
+
+ $cmd ticket comment show 4
+ Show ticket comment 4 and all metadata
+
+
+== Working with ticket attachments
+
+ $cmd ticket attachment create 456 --file bugfix.patch
+ Create a new attachment on this ticket from the file 'bugfix.patch'.
+
+ $cmd ticket attachment list 456
+ Show all attachemnts on ticket 456
+
+ $cmd ticket attachment content 567
+ Send the content of attachment 567 to STDOUT
+
+ $cmd ticket resolve 123
+ Sets the status of the ticket with local id 123 to closed
+
+
+= Sharing ticket databases
+
+ $cmd pull --from http://example.com/path/to/sd
+ Integrate changes from a published SD replica over http, ftp or
+ file URL schemes.
+
+ $cmd pull --all
+ Integrate changes from all replicas this replica has pulled from
+ before
+
+ $cmd pull --local
+ Integrate changes from all replicas currently announcing themselves
+ on the local network using Bonjour
+
+ $cmd publish --to jesse\@server:path/to/destination
+ Publish a copy of this replica to a remote server using rsync over
+ ssh.
+
+ $cmd publish --html --replica --to jesse\@server:path/to/destination
+ Publish a copy of this replica, including a static html representation,
+ to a remote server using rsync over ssh.
+
+
+= ENVIRONMENT
+
+ export SD_REPO=/path/to/sd/replica
+ Specify where the ticket database SD is using should reside
+
+EOF
+
+}
+
+__PACKAGE__->meta->make_immutable;
+no Moose;
+
+1;
+
Added: sd/trunk/lib/App/SD/CLI/Command/Help/Sync.pm
==============================================================================
--- (empty file)
+++ sd/trunk/lib/App/SD/CLI/Command/Help/Sync.pm Tue Aug 12 07:26:02 2008
@@ -0,0 +1,39 @@
+
+package App::SD::CLI::Command::Help::Sync;
+use Moose;
+extends 'App::SD::CLI::Command::Help';
+
+sub run {
+ my $self = shift;
+ $self->print_header('Sharing ticket databases');
+ my $cmd = $self->_get_cmd_name;
+
+print <<EOF
+ $cmd pull --from http://example.com/path/to/sd
+ Integrate changes from a published SD replica over http, ftp or
+ file URL schemes.
+
+ $cmd pull --all
+ Integrate changes from all replicas this replica has pulled from
+ before
+
+ $cmd pull --local
+ Integrate changes from all replicas currently announcing themselves
+ on the local network using Bonjour
+
+ $cmd publish --to jesse\@server:path/to/destination
+ Publish a copy of this replica to a remote server using rsync over
+ ssh.
+
+ $cmd publish --html --replica --to jesse\@server:path/to/destination
+ Publish a copy of this replica, including a static html representation,
+ to a remote server using rsync over ssh.
+EOF
+
+}
+
+__PACKAGE__->meta->make_immutable;
+no Moose;
+
+1;
+
Added: sd/trunk/lib/App/SD/CLI/Command/Help/Tickets.pm
==============================================================================
--- (empty file)
+++ sd/trunk/lib/App/SD/CLI/Command/Help/Tickets.pm Tue Aug 12 07:26:02 2008
@@ -0,0 +1,34 @@
+package App::SD::CLI::Command::Help::Tickets;
+use Moose;
+extends 'App::SD::CLI::Command::Help';
+
+sub run {
+ my $self = shift;
+ $self->print_header('Working with tickets');
+ my $cmd = $self->_get_cmd_name;
+
+print <<EOF
+ $cmd ticket create
+ Invokes a text editor with a ticket creation template
+
+ $cmd ticket create --summary="This is a summary" status=open
+ Create a new ticket non-interactively
+
+ $cmd ticket update 123 -- status=closed
+ Sets the status of the ticket with local id 123 to closed
+
+ $cmd ticket resolve 123
+ Sets the status of the ticket with local id 123 to closed
+
+ $cmd ticket update fad5849a-67f1-11dd-bde1-5b33d3ff2799 -- status=closed
+ Sets the status of the ticket with uuid
+ fad5849a-67f1-11dd-bde1-5b33d3ff2799 to closed
+EOF
+
+}
+
+__PACKAGE__->meta->make_immutable;
+no Moose;
+
+1;
+
More information about the Bps-public-commit
mailing list