blib/lib/Git/Wrapper/Plus/Support/Arguments.pm untested

filter: Statementstmt 0.0% 0 / 45 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 13 Podpod 0.0% 0 / 6 totaltotal 0.0% 0 / 70 SCAR 30.0
CC
4
Cov
0%
arguments
6.0
has_argument
6.0
argument_supports
6.0
CRAP 20.0
1 use 5.008; # utf8
2 use strict;
3 use warnings;
4 use utf8;
5  
6 package Git::Wrapper::Plus::Support::Arguments;
7 $Git::Wrapper::Plus::Support::Arguments::VERSION = '0.004010';
8 # ABSTRACT: Database of command argument support data
9  
10 our $AUTHORITY = 'cpan:KENTNL'; # AUTHORITY
11  
12 use Moo qw( has );
13  
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 has 'entries' => ( is => ro =>, lazy => 1, builder => 1 );
42  
43 sub _build_entries {
44 my $hash = {};
45 require Git::Wrapper::Plus::Support::RangeDictionary;
46 $hash->{'cat-file'} = Git::Wrapper::Plus::Support::RangeDictionary->new();
47 $hash->{'cat-file'}->add_range(
48 '-e' => {
49 'min' => '1.0.0',
50 'min_tag' => '0.99.9l',
51 'min_sha1' => '7950571ad75c1c97e5e53626d8342b01b167c790',
52 },
53 );
54 return $hash;
55 }
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67 sub commands {
68 my ($self) = @_;
69 my (@items) = sort keys %{ $self->entries };
70 return @items;
71 }
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83 sub arguments {
84 my ( $self, $command ) = @_;
85 return unless $self->has_command($command);
86 return $self->entries->{$command}->entries;
87 }
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99 sub has_command {
100 my ( $self, $command ) = @_;
101 return exists $self->entries->{$command};
102 }
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114 sub has_argument {
115 my ( $self, $command, $argument ) = @_;
116 return unless $self->has_command($command);
117 return $self->entries->{$command}->has_entry($argument);
118 }
119  
120  
121  
122  
123  
124  
125  
126  
127  
128 sub argument_supports {
129 my ( $self, $command, $argument, $version_object ) = @_;
130 return unless $self->has_argument( $command, $argument );
131 return $self->entries->{$command}->entry_supports( $argument, $version_object );
132 }
133  
134 no Moo;
135 1;
136  
137 __END__