lib/App/gh/Command/Search.pm

filter: Statementstmt 68.5% 24 / 35 Branchbran n/a Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 88.8% 8 / 9 Podpod 0.0% 0 / 1 totaltotal 66.6% 32 / 48 CC 3 SCAR 13.9
CC
3
Cov
65%
run
12.0
BEGIN
1.0
BEGIN
1.0
CRAP 4.0
« blib/lib/App/gh/Command/Recent.pm ↑ Summary blib/lib/App/gh/Command/Issue.pm »
1 package App::gh::Command::Search;
2 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use base qw(App::gh::Command);
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use App::gh::Utils;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use App::gh;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use Term::ANSIColor;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use Text::Wrap;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use v5.10;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 =head1 NAME
12  
13 App::gh::Command::Search - search repositories
14  
15 =head1 USAGE
16  
17 $ gh search perl6
18  
19 =cut
20  
21 0 ▶sub run {
Subroutine run: not called CC=3 SCAR=24.8
Pod undocumented
22 0 my ($self,$keyword) = @_;
23 0 local $|;
24 0 info "Fetching list...";
25  
26 0 my $data = App::gh->github->query( 'GET' , '/legacy/repos/search/' . $keyword );
27  
28 0 my @ary = ();
29 0 for my $repo ( @{ $data->{repositories} } ) {
30 0 my $name = sprintf "%s/%s", $repo->{username} , $repo->{name};
31 0 my $desc = $repo->{description};
32 0 ▶ push @ary, [ $name , $desc || '' ];
Condition0%0/2
$desc || ''
l!l
00
MC/DC0%0/1
$desc || ''
$desc
Truth table0%0/2
A
A= $desc
Aresult
11
00
33 }
34 0 print_list @ary;
35  
36 # my $result = App::gh->api->search($keyword);
37 # if( $self->{long} ) {
38 # for my $entry ( @{ $result->{repositories} } ) {
39 # print color 'white bold';
40 # say "* $entry->{owner}/$entry->{name}";
41 # print color 'reset';
42 # say " W/F: $entry->{watchers}/$entry->{forks}";
43 # say " Url: " . $entry->{url} if $entry->{url};
44 # say " Homepage: " . $entry->{homepage} if $entry->{homepage};
45 # say "\n" . wrap( ' ', ' ', $entry->{description} ) . "\n";
46 # }
47 # } else {
48 # my @ary = ();
49 # for my $repo ( @{ $result->{repositories} } ) {
50 # }
51 # # print short list
52 # }
53  
54 }
55  
56 1 1;
57 __END__
« blib/lib/App/gh/Command/Recent.pm ↑ Summary blib/lib/App/gh/Command/Issue.pm »