line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::gh::Command::Info; |
2
|
1
|
|
|
1
|
|
1724
|
use utf8; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
10
|
|
3
|
1
|
|
|
1
|
|
33
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
29
|
|
4
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
128
|
|
5
|
1
|
|
|
1
|
|
6
|
use base qw(App::gh::Command); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
105
|
|
6
|
1
|
|
|
1
|
|
7
|
use App::gh; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
22
|
|
7
|
1
|
|
|
1
|
|
5
|
use App::gh::Utils; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
719
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub parse_uri { |
10
|
0
|
|
|
0
|
0
|
|
my ($uri) = @_; |
11
|
0
|
0
|
|
|
|
|
if ( $uri =~ m{(git|https?)://github.com/(.*?)/(.*?).git} ) { |
|
|
0
|
|
|
|
|
|
12
|
0
|
|
|
|
|
|
return ($2,$3,$1); |
13
|
|
|
|
|
|
|
} elsif ( $uri =~ m{git\@github.com:(.*?)/(.*?).git} ) { |
14
|
0
|
|
|
|
|
|
return ($1,$2,'git'); |
15
|
|
|
|
|
|
|
} |
16
|
0
|
|
|
|
|
|
return undef; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub get_remote { |
20
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
21
|
0
|
|
|
|
|
|
my $config = App::gh->config->current(); |
22
|
0
|
|
|
|
|
|
my %remotes = %{ $config->{remote} }; |
|
0
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
# try to get origin remote |
24
|
0
|
|
0
|
|
|
|
return $remotes{origin} || (values( %remotes ))[0]; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub run { |
28
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
29
|
|
|
|
|
|
|
# my $gh_id = App::gh->config->github_id(); |
30
|
0
|
|
|
|
|
|
my $remote = $self->get_remote(); |
31
|
0
|
0
|
|
|
|
|
die "Remote not found\n." unless $remote; |
32
|
0
|
|
|
|
|
|
my ( $user, $repo, $uri_type ) = parse_uri( $remote->{url} ); |
33
|
0
|
|
|
|
|
|
my $ret = App::gh->api->repo_info( $user, $repo ); |
34
|
0
|
|
|
|
|
|
App::gh::Utils->print_repo_info( $ret ); |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
1; |
39
|
|
|
|
|
|
|
__END__ |