| 1 | package App::gh::Command::Info; | ||||||||||||||||||||
| 2 | 1 | ▶ | use utf8; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 3 | 1 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 4 | 1 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 5 | 1 | ▶ | use base qw(App::gh::Command); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 6 | 1 | ▶ | use App::gh; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 7 | 1 | ▶ | use App::gh::Utils; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 8 | |||||||||||||||||||||
| 9 | 0 | ▶ | sub parse_uri { | ||||||||||||||||||
|
Subroutine
parse_uri: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||
| 10 | 0 | my ($uri) = @_; | |||||||||||||||||||
| 11 | 0 | ▶ | if ( $uri =~ m{(git|https?)://github.com/(.*?)/(.*?).git} ) { | ||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||
| 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 | 0 | ▶ | sub get_remote { | ||||||||||||||||||
|
Subroutine
get_remote: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||
| 20 | 0 | my $self = shift; | |||||||||||||||||||
| 21 | 0 | my $config = App::gh->config->current(); | |||||||||||||||||||
| 22 | 0 | my %remotes = %{ $config->{remote} }; | |||||||||||||||||||
| 23 | # try to get origin remote | ||||||||||||||||||||
| 24 | 0 | ▶ | return $remotes{origin} || (values( %remotes ))[0]; | ||||||||||||||||||
|
Condition0%0/3
$remotes{'origin'} || (values %remotes)[0]
MC/DC0%0/2
$remotes{'origin'} || (values %remotes)[0]
$remotes{'origin'}
(values %remotes)[0]
Truth table0%0/3
A || B
A= $remotes{'origin'}B= (values %remotes)[0]
| |||||||||||||||||||||
| 25 | } | ||||||||||||||||||||
| 26 | |||||||||||||||||||||
| 27 | 0 | ▶ | sub run { | ||||||||||||||||||
|
Subroutine
run: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||
| 28 | 0 | my $self = shift; | |||||||||||||||||||
| 29 | # my $gh_id = App::gh->config->github_id(); | ||||||||||||||||||||
| 30 | 0 | my $remote = $self->get_remote(); | |||||||||||||||||||
| 31 | 0 | ▶ | die "Remote not found\n." unless $remote; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 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 | 1; | |||||||||||||||||||
| 39 | __END__ | ||||||||||||||||||||