/
Admin.pm
69 lines (43 loc) · 1.48 KB
/
Admin.pm
1
2
3
4
5
6
7
8
9
10
11
12
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
package App::Pinto::Admin;
# ABSTRACT: Command-line driver for Pinto
use strict;
use warnings;
use App::Cmd::Setup -app;
#------------------------------------------------------------------------------
# VERSION
#------------------------------------------------------------------------------
sub global_opt_spec {
return (
[ 'repos|r=s' => 'Path to your repository directory' ],
[ 'nocolor' => 'Do not colorize diagnostic messages' ],
[ 'quiet|q' => 'Only report fatal errors' ],
[ 'verbose|v+' => 'More diagnostic output (repeatable)' ],
);
}
#------------------------------------------------------------------------------
sub usage_desc {
return '%c [global options] <command> [command options]';
}
#------------------------------------------------------------------------------
=method pinto()
Returns a reference to the L<Pinto> object. If it does not already
exist, one will be created using the global options.
=cut
sub pinto {
my ($self) = @_;
return $self->{pinto} ||= do {
my %global_options = %{ $self->global_options() };
$global_options{repos}
or $self->usage_error('Must specify a repository');
require Pinto;
my $pinto = Pinto->new(%global_options);
};
}
#------------------------------------------------------------------------------
1;
__END__
=pod
=head1 DESCRIPTION
There is nothing to see here. You probably should look at the
documentation for L<pinto> instead.
=cut