line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::gh::Command::Network; |
2
|
1
|
|
|
1
|
|
1391
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
43
|
|
3
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
39
|
|
4
|
1
|
|
|
1
|
|
5
|
use base qw(App::gh::Command); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
90
|
|
5
|
1
|
|
|
1
|
|
7
|
use App::gh; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
19
|
|
6
|
1
|
|
|
1
|
|
5
|
use App::gh::Utils; |
|
1
|
|
|
|
|
11
|
|
|
1
|
|
|
|
|
459
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
App::gh::Command::Network - show network |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 USAGE |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
$ cd App-gh |
15
|
|
|
|
|
|
|
$ gh network |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=cut |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub options { ( |
21
|
0
|
|
|
0
|
0
|
|
'i|id' => 'id_only', # id only |
22
|
|
|
|
|
|
|
) } |
23
|
|
|
|
|
|
|
|
24
|
0
|
|
|
0
|
0
|
|
sub require_local_gitconfig { 1 } |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub get_networks { |
29
|
0
|
|
|
0
|
0
|
|
my $config = App::gh->config->current(); |
30
|
0
|
|
|
|
|
|
my ( $name, $url ) = split( /\s+/, qx( git remote -v | grep origin | grep push ) ); |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
# git://github.com/miyagawa/Tatsumaki.git |
33
|
|
|
|
|
|
|
# -or- |
34
|
|
|
|
|
|
|
# https://github.com/miyagawa/Tatsumaki.git |
35
|
0
|
0
|
0
|
|
|
|
if ( $url && ( $url =~ m{git://github.com/(.*?)/(.*?)\.git} |
|
|
|
0
|
|
|
|
|
36
|
|
|
|
|
|
|
|| $url =~ m{git\@github.com:(.*?)/(.*?)\.git} |
37
|
|
|
|
|
|
|
|| $url =~ m{https://github.com/(.*?)/(.*?)\.git} ) ) { |
38
|
|
|
|
|
|
|
|
39
|
0
|
|
|
|
|
|
my ( $acc, $repo ) = ( $1, $2 ); |
40
|
0
|
|
|
|
|
|
return App::gh->api->repo_network( $acc , $repo ); |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub run { |
45
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
46
|
0
|
|
|
|
|
|
my $networks = $self->get_networks; |
47
|
0
|
|
|
|
|
|
for my $net ( @$networks ) { |
48
|
0
|
0
|
|
|
|
|
if( $self->{id_only} ) { |
49
|
0
|
|
|
|
|
|
print $net->{owner} . "\n"; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
else { |
52
|
0
|
|
|
|
|
|
printf( "% 17s - watchers(%d) forks(%d)\n" |
53
|
|
|
|
|
|
|
, $net->{owner} . '/' . $net->{name} |
54
|
|
|
|
|
|
|
, $net->{watchers} |
55
|
|
|
|
|
|
|
, $net->{forks} |
56
|
|
|
|
|
|
|
); |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
1; |