line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Minilla::CLI; |
2
|
1
|
|
|
1
|
|
3432
|
use strict; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
29
|
|
3
|
1
|
|
|
1
|
|
8
|
use warnings; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
26
|
|
4
|
1
|
|
|
1
|
|
5
|
use utf8; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
7
|
|
5
|
1
|
|
|
1
|
|
22
|
use Getopt::Long; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
9
|
|
6
|
1
|
|
|
1
|
|
730
|
use Try::Tiny; |
|
1
|
|
|
|
|
1386
|
|
|
1
|
|
|
|
|
69
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
10
|
use Minilla; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
18
|
|
9
|
1
|
|
|
1
|
|
5
|
use Minilla::Errors; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
18
|
|
10
|
1
|
|
|
1
|
|
5
|
use Minilla::Project; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
22
|
|
11
|
1
|
|
|
1
|
|
4
|
use Minilla::Util qw(find_dir); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
50
|
|
12
|
1
|
|
|
1
|
|
7
|
use Minilla::Logger; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
52
|
|
13
|
|
|
|
|
|
|
|
14
|
1
|
|
|
1
|
|
432
|
use Minilla::CLI::New; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
30
|
|
15
|
1
|
|
|
1
|
|
396
|
use Minilla::CLI::Help; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
30
|
|
16
|
1
|
|
|
1
|
|
398
|
use Minilla::CLI::Dist; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
32
|
|
17
|
1
|
|
|
1
|
|
411
|
use Minilla::CLI::Test; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
29
|
|
18
|
1
|
|
|
1
|
|
402
|
use Minilla::CLI::Release; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
49
|
|
19
|
1
|
|
|
1
|
|
510
|
use Minilla::CLI::Install; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
32
|
|
20
|
|
|
|
|
|
|
|
21
|
1
|
|
|
1
|
|
6
|
use Moo; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
11
|
|
22
|
|
|
|
|
|
|
|
23
|
1
|
|
|
1
|
|
449
|
no Moo; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
4
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub run { |
26
|
0
|
|
|
0
|
0
|
|
my ($self, @args) = @_; |
27
|
|
|
|
|
|
|
|
28
|
0
|
|
|
|
|
|
local $Minilla::AUTO_INSTALL = 1; |
29
|
0
|
0
|
|
|
|
|
local $Minilla::Logger::COLOR = -t STDOUT ? 1 : 0; |
30
|
0
|
|
|
|
|
|
local @ARGV = @args; |
31
|
0
|
|
|
|
|
|
my @commands; |
32
|
|
|
|
|
|
|
my $version; |
33
|
0
|
|
|
|
|
|
my $p = Getopt::Long::Parser->new( |
34
|
|
|
|
|
|
|
config => [ "no_ignore_case", "pass_through" ], |
35
|
|
|
|
|
|
|
); |
36
|
|
|
|
|
|
|
$p->getoptions( |
37
|
0
|
|
|
0
|
|
|
"h|help" => sub { unshift @commands, 'help' }, |
38
|
0
|
|
|
|
|
|
"color!" => \$Minilla::Logger::COLOR, |
39
|
|
|
|
|
|
|
"debug!" => \$Minilla::DEBUG, |
40
|
|
|
|
|
|
|
"auto-install!" => \$Minilla::AUTO_INSTALL, |
41
|
|
|
|
|
|
|
'version!' => \$version, |
42
|
|
|
|
|
|
|
); |
43
|
|
|
|
|
|
|
|
44
|
0
|
0
|
|
|
|
|
if ($version) { |
45
|
0
|
|
|
|
|
|
print "Minilla: $Minilla::VERSION\n"; |
46
|
0
|
|
|
|
|
|
exit 0; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
0
|
|
|
|
|
|
push @commands, @ARGV; |
50
|
|
|
|
|
|
|
|
51
|
0
|
|
0
|
|
|
|
my $cmd = shift @commands || 'help'; |
52
|
0
|
|
|
|
|
|
my $klass = sprintf("Minilla::CLI::%s", ucfirst($cmd)); |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
## no critic |
55
|
0
|
0
|
|
|
|
|
if (eval sprintf("require %s; 1;", $klass)) { |
56
|
|
|
|
|
|
|
try { |
57
|
0
|
|
|
0
|
|
|
$klass->run(@commands); |
58
|
|
|
|
|
|
|
} catch { |
59
|
0
|
0
|
|
0
|
|
|
/Minilla::Error::CommandExit/ and return; |
60
|
0
|
|
|
|
|
|
errorf("%s\n", $_); |
61
|
0
|
|
|
|
|
|
exit 1; |
62
|
|
|
|
|
|
|
} |
63
|
0
|
|
|
|
|
|
} else { |
64
|
0
|
|
|
|
|
|
warnf("Could not find command '%s'\n", $cmd); |
65
|
0
|
0
|
|
|
|
|
if ($@ !~ /^Can't locate Minilla/) { |
66
|
0
|
|
|
|
|
|
errorf("$@\n"); |
67
|
|
|
|
|
|
|
} |
68
|
0
|
|
|
|
|
|
exit 2; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
1; |
73
|
|
|
|
|
|
|
|