| 1 | package App::SD::CLI::Command::Help; | ||
| 2 | use Any::Moose; | ||
| 3 | extends 'Prophet::CLI::Command'; | ||
| 4 | with 'App::SD::CLI::Command'; | ||
| 5 | |||
| 6 | sub usage_msg { | ||
| 7 | my $self = shift; | ||
| 8 | my $cmd = $self->cli->get_script_name; | ||
| 9 | |||
| 10 | return <<"END_USAGE"; | ||
| 11 | usage: ${cmd}help [<topic>] | ||
| 12 | END_USAGE | ||
| 13 | } | ||
| 14 | |||
| 15 | sub title { | ||
| 16 | my $self = shift; | ||
| 17 | |||
| 18 | } | ||
| 19 | |||
| 20 | sub version { | ||
| 21 | my $self = shift; | ||
| 22 | "sd ".$App::SD::VERSION; | ||
| 23 | |||
| 24 | } | ||
| 25 | |||
| 26 | sub print_header { | ||
| 27 | my $self = shift; | ||
| 28 | my $title = shift; | ||
| 29 | my $string = join(' - ', $self->version, $title); | ||
| 30 | |||
| 31 | $self->print_usage if $self->has_arg('h'); | ||
| 32 | |||
| 33 | print "\n".$string . "\n"; | ||
| 34 | print '-' x ( length($string)); | ||
| 35 | print "\n"; | ||
| 36 | |||
| 37 | } | ||
| 38 | |||
| 39 | sub run { | ||
| 40 | my $self = shift; | ||
| 41 | my ${cmd}= $self->cli->get_script_name; | ||
| 42 | |||
| 43 | $self->print_header("Help Index"); | ||
| 44 | |||
| 45 | |||
| 46 | print <<EOF | ||
| 47 | |||
| 48 | ${cmd}help intro - Getting started with SD | ||
| 49 | ${cmd}help search - Searching for and displaying tickets | ||
| 50 | ${cmd}help tickets - Working with tickets | ||
| 51 | ${cmd}help comments - Working with ticket comments | ||
| 52 | ${cmd}help attachments - Working with ticket attachments | ||
| 53 | ${cmd}help sync - Publishing and importing ticket databases | ||
| 54 | ${cmd}help history - Viewing repository history | ||
| 55 | ${cmd}help environment - Environment variables which affect sd | ||
| 56 | ${cmd}help config - Local configuration variables | ||
| 57 | ${cmd}help ticket.summary_format - Details of this config variable | ||
| 58 | ${cmd}help aliases - Command aliases | ||
| 59 | ${cmd}help settings - Database configuration variables | ||
| 60 | |||
| 61 | Running '${cmd}help' on a specific command should also redirect you | ||
| 62 | to the proper help file. | ||
| 63 | |||
| 64 | You can also get a brief summary of usage (options and arguments) for | ||
| 65 | a given command with '${cmd}<command> -h'. | ||
| 66 | |||
| 67 | EOF | ||
| 68 | |||
| 69 | } | ||
| 70 | |||
| 71 | #__PACKAGE__->meta->make_immutable; | ||
| 72 | #no Any::Moose; | ||
| 73 | |||
| 74 | 1; | ||
| 75 |