line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#!/usr/bin/env perl |
2
|
|
|
|
|
|
|
package yq; |
3
|
|
|
|
|
|
|
our $VERSION = '0.037'; |
4
|
|
|
|
|
|
|
# ABSTRACT: Filter YAML through a command-line program |
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
617
|
use ETL::Yertl; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
13
|
|
7
|
1
|
|
|
1
|
|
372
|
use Pod::Usage::Return qw( pod2usage ); |
|
1
|
|
|
|
|
42051
|
|
|
1
|
|
|
|
|
69
|
|
8
|
1
|
|
|
1
|
|
570
|
use Getopt::Long qw( GetOptionsFromArray ); |
|
1
|
|
|
|
|
8068
|
|
|
1
|
|
|
|
|
5
|
|
9
|
1
|
|
|
1
|
|
669
|
use ETL::Yertl::Command::yq; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
221
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
$|++; # no buffering |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub main { |
14
|
11
|
|
|
11
|
|
189268
|
my ( $class, @argv ) = @_; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
my %opt = ( |
17
|
|
|
|
|
|
|
verbose => $ENV{YERTL_VERBOSE}, |
18
|
11
|
|
|
|
|
39
|
); |
19
|
|
|
|
|
|
|
|
20
|
11
|
|
|
|
|
78
|
GetOptionsFromArray( \@argv, \%opt, |
21
|
|
|
|
|
|
|
'help|h', |
22
|
|
|
|
|
|
|
'verbose|v+', |
23
|
|
|
|
|
|
|
'version', |
24
|
|
|
|
|
|
|
'xargs|x', |
25
|
|
|
|
|
|
|
); |
26
|
11
|
100
|
|
|
|
3680
|
return pod2usage(0) if $opt{help}; |
27
|
10
|
100
|
|
|
|
35
|
if ( $opt{version} ) { |
28
|
1
|
|
|
|
|
45
|
print "yq version $yq::VERSION (Perl $^V)\n"; |
29
|
1
|
|
|
|
|
6
|
return 0; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
9
|
|
|
|
|
20
|
eval { |
33
|
9
|
|
|
|
|
110
|
ETL::Yertl::Command::yq->main( @argv, \%opt ); |
34
|
|
|
|
|
|
|
}; |
35
|
9
|
100
|
|
|
|
27
|
if ( $@ ) { |
36
|
1
|
|
|
|
|
7
|
return pod2usage( "ERROR: $@" ); |
37
|
|
|
|
|
|
|
} |
38
|
8
|
|
|
|
|
34
|
return 0; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
exit __PACKAGE__->main( @ARGV ) unless caller(0); |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
__END__ |