File: | lib/Code/Statistics/App.pm |
Coverage: | 100.0% |
line | stmt | bran | cond | sub | pod | time | code |
---|---|---|---|---|---|---|---|
1 | 1 1 1 | 0 0 0 | use strict; | ||||
2 | 1 1 1 | 0 0 0 | use warnings; | ||||
3 | |||||||
4 | package Code::Statistics::App; | ||||||
5 | |||||||
6 | # ABSTRACT: handles global command configuration and cstat instantiation | ||||||
7 | |||||||
8 | 1 1 1 | 0 0 0 | use App::Cmd::Setup -app; | ||||
9 | |||||||
10 | 1 1 1 | 0 0 0 | use Code::Statistics; | ||||
11 | |||||||
12 | sub global_opt_spec { | ||||||
13 | 6 | 0 | my @opts = ( | ||||
14 | [ 'global_conf_file|g=s' => 'path to the global config file' ], | ||||||
15 | [ 'conf_file|c=s' => 'path to the local config file' ], | ||||||
16 | [ 'profile|p=s' => 'a configuration profile' ], | ||||||
17 | ); | ||||||
18 | 6 | 0 | return @opts; | ||||
19 | } | ||||||
20 | |||||||
21 - 23 | =head2 cstat Creates a Code::Statistics object with the given commandline args. =cut | ||||||
24 | |||||||
25 | sub cstat { | ||||||
26 | 3 | 0 | my ( $self, %command_args ) = @_; | ||||
27 | |||||||
28 | 3 3 | 0 0 | my %args = ( %{ $self->global_options }, command => ( $self->get_command( @ARGV ) )[0], ); | ||||
29 | |||||||
30 | 3 | 0 | return Code::Statistics->new( %args, args => \%command_args ); | ||||
31 | } | ||||||
32 | |||||||
33 | 1; |