| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Riji::CLI; |
|
2
|
10
|
|
|
10
|
|
60
|
use feature ':5.10'; |
|
|
10
|
|
|
|
|
17
|
|
|
|
10
|
|
|
|
|
1752
|
|
|
3
|
10
|
|
|
10
|
|
80
|
use strict; |
|
|
10
|
|
|
|
|
24
|
|
|
|
10
|
|
|
|
|
247
|
|
|
4
|
10
|
|
|
10
|
|
38
|
use warnings; |
|
|
10
|
|
|
|
|
14
|
|
|
|
10
|
|
|
|
|
493
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
10
|
|
|
10
|
|
7021
|
use IPC::Cmd (); |
|
|
10
|
|
|
|
|
736632
|
|
|
|
10
|
|
|
|
|
363
|
|
|
7
|
10
|
|
|
10
|
|
8259
|
use Getopt::Long (); |
|
|
10
|
|
|
|
|
160198
|
|
|
|
10
|
|
|
|
|
527
|
|
|
8
|
10
|
|
|
10
|
|
4720
|
use Plack::Util (); |
|
|
10
|
|
|
|
|
40742
|
|
|
|
10
|
|
|
|
|
245
|
|
|
9
|
10
|
|
|
10
|
|
4506
|
use String::CamelCase (); |
|
|
10
|
|
|
|
|
6633
|
|
|
|
10
|
|
|
|
|
4843
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub run { |
|
12
|
10
|
|
|
10
|
0
|
49
|
my ($self, @args) = @_; |
|
13
|
|
|
|
|
|
|
|
|
14
|
10
|
|
|
|
|
43
|
local @ARGV = @args; |
|
15
|
10
|
|
|
|
|
24
|
my @commands; |
|
16
|
10
|
|
|
|
|
157
|
my $p = Getopt::Long::Parser->new( |
|
17
|
|
|
|
|
|
|
config => [ "no_ignore_case", "pass_through" ], |
|
18
|
|
|
|
|
|
|
); |
|
19
|
|
|
|
|
|
|
$p->getoptions( |
|
20
|
0
|
|
|
0
|
|
0
|
"h|help" => sub { unshift @commands, 'help' }, |
|
21
|
10
|
|
|
|
|
13952
|
'version!' => \my $version, |
|
22
|
|
|
|
|
|
|
); |
|
23
|
10
|
50
|
|
|
|
7843
|
if ($version) { |
|
24
|
0
|
|
|
|
|
0
|
require Riji; |
|
25
|
0
|
|
|
|
|
0
|
say "Riji: $Riji::VERSION"; exit 0; |
|
|
0
|
|
|
|
|
0
|
|
|
26
|
|
|
|
|
|
|
} |
|
27
|
10
|
|
|
|
|
75
|
push @commands, @ARGV; |
|
28
|
|
|
|
|
|
|
|
|
29
|
10
|
|
50
|
|
|
57
|
my $cmd = shift @commands || 'help'; |
|
30
|
10
|
50
|
|
|
|
95
|
if (my $cmd = IPC::Cmd::can_run("riji-$cmd")) { |
|
31
|
0
|
|
|
|
|
0
|
exec $cmd, @commands; |
|
32
|
|
|
|
|
|
|
} |
|
33
|
|
|
|
|
|
|
|
|
34
|
10
|
|
|
|
|
1350261
|
$cmd =~ s/-/_/g; |
|
35
|
10
|
|
|
|
|
138
|
my $class = String::CamelCase::camelize $cmd; |
|
36
|
|
|
|
|
|
|
|
|
37
|
10
|
|
|
|
|
213
|
local $@; |
|
38
|
10
|
|
|
|
|
48
|
$class = eval { Plack::Util::load_class($class, 'Riji::CLI') }; |
|
|
10
|
|
|
|
|
114
|
|
|
39
|
10
|
50
|
|
|
|
150
|
if (my $err = $@) { |
|
40
|
0
|
0
|
|
|
|
0
|
if ($err =~ m!Can't locate Riji/CLI!) { |
|
41
|
0
|
|
|
|
|
0
|
warn "sub command `$cmd` not found\n"; exit 1; |
|
|
0
|
|
|
|
|
0
|
|
|
42
|
|
|
|
|
|
|
} |
|
43
|
0
|
|
|
|
|
0
|
die $@; |
|
44
|
|
|
|
|
|
|
} |
|
45
|
10
|
|
|
|
|
101
|
$class->run(@commands); |
|
46
|
|
|
|
|
|
|
} |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
1; |