File Coverage

lib/SweetPea/Cli/Help.pm
Criterion Covered Total %
statement 6 17 35.2
branch 0 2 0.0
condition n/a
subroutine 2 4 50.0
pod 0 2 0.0
total 8 25 32.0


line stmt bran cond sub pod time code
1             package SweetPea::Cli::Help;
2              
3 1     1   10 use warnings;
  1         3  
  1         43  
4 1     1   6 use strict;
  1         3  
  1         237  
5              
6             # SweetPea::Cli::Help - Help documentation for SweetPea-Cli
7              
8             sub new {
9 0     0 0   my ($class, $s) = @_;
10 0           my $self = {};
11 0           bless $self, $class;
12 0           return $self;
13             }
14              
15              
16             # display
17             # Show help screen for a given function
18              
19             sub display {
20 0     0 0   my $self = shift;
21 0           my ($cmd, $c) = @_;
22 0           my $u = SweetPea::Cli::Util->new;
23 0           my $e = SweetPea::Cli::Error->new;
24            
25 0 0         if (defined $c->{_commands}->{$cmd}) {
26 0           return $u->template("documents/help/$cmd"."_help.tt", $c);
27             }
28             else {
29 0           return $e->error("Sorry, cannot find help for $cmd.")->report($c);
30             }
31             }
32              
33             1; # End of SweetPea::Cli::Help