File Coverage

blib/lib/Git/Wrapper/Plus/Support/Arguments.pm
Criterion Covered Total %
statement 34 34 100.0
branch 3 6 50.0
condition n/a
subroutine 11 11 100.0
pod 5 5 100.0
total 53 56 94.6


line stmt bran cond sub pod time code
1 2     2   416 use 5.006; # our
  2         7  
2 2     2   12 use strict;
  2         3  
  2         56  
3 2     2   12 use warnings;
  2         5  
  2         178  
4              
5             package Git::Wrapper::Plus::Support::Arguments;
6              
7             our $VERSION = '0.004011';
8              
9             # ABSTRACT: Database of command argument support data
10              
11             our $AUTHORITY = 'cpan:KENTNL'; # AUTHORITY
12              
13 2     2   415 use Moo qw( has );
  2         8993  
  2         17  
14              
15              
16              
17              
18              
19              
20              
21              
22              
23              
24              
25              
26              
27              
28              
29              
30              
31              
32              
33              
34              
35              
36              
37              
38              
39              
40              
41              
42             has 'entries' => ( is => ro =>, lazy => 1, builder => 1 );
43              
44             sub _build_entries {
45 1     1   9 my $hash = {};
46 1         8 require Git::Wrapper::Plus::Support::RangeDictionary;
47 1         28 $hash->{'cat-file'} = Git::Wrapper::Plus::Support::RangeDictionary->new();
48 1         29 $hash->{'cat-file'}->add_range(
49             '-e' => {
50             'min' => '1.0.0',
51             'min_tag' => '0.99.9l',
52             'min_sha1' => '7950571ad75c1c97e5e53626d8342b01b167c790',
53             },
54             );
55 1         7 return $hash;
56             }
57              
58              
59              
60              
61              
62              
63              
64              
65              
66              
67              
68             sub commands {
69 1     1 1 1076 my ($self) = @_;
70 1         2 my (@items) = sort keys %{ $self->entries };
  1         25  
71 1         6 return @items;
72             }
73              
74              
75              
76              
77              
78              
79              
80              
81              
82              
83              
84             sub arguments {
85 1     1 1 32 my ( $self, $command ) = @_;
86 1 50       2 return unless $self->has_command($command);
87 1         31 return $self->entries->{$command}->entries;
88             }
89              
90              
91              
92              
93              
94              
95              
96              
97              
98              
99              
100             sub has_command {
101 3     3 1 4 my ( $self, $command ) = @_;
102 3         58 return exists $self->entries->{$command};
103             }
104              
105              
106              
107              
108              
109              
110              
111              
112              
113              
114              
115             sub has_argument {
116 2     2 1 10 my ( $self, $command, $argument ) = @_;
117 2 50       5 return unless $self->has_command($command);
118 2         62 return $self->entries->{$command}->has_entry($argument);
119             }
120              
121              
122              
123              
124              
125              
126              
127              
128              
129             sub argument_supports {
130 1     1 1 34 my ( $self, $command, $argument, $version_object ) = @_;
131 1 50       3 return unless $self->has_argument( $command, $argument );
132 1         28 return $self->entries->{$command}->entry_supports( $argument, $version_object );
133             }
134              
135 2     2   1958 no Moo;
  2         3  
  2         9  
136             1;
137              
138             __END__