script/gh-open

filter: Statementstmt 76.4% 26 / 34 Branchbran 37.5% 3 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod n/a totaltotal 72.9% 35 / 48 CC 1 SCAR 0.0
CC
1
Cov
69%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« blib/lib/Git/Helpers/CPAN.pm ↑ Summary
1 #!perl
2  
3 # ABSTRACT: Open a browser window with the GitHub URL of the repository which you are currently inside of
4 # PODNAME: gh-open
5  
6 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 1 ▶use Browser::Open qw( open_browser );
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use Getopt::Long qw( GetOptions );
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 ▶use Git::Helpers qw( https_remote_url );
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 ▶use Pod::Usage qw(pod2usage);
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 1 my $branch;
15 my $echo;
16 1 my $help;
17 1 my $version;
18  
19 1 GetOptions(
20 branch => \$branch, echo => \$echo, help => \$help,
21 version => \$version,
22 );
23  
24 1 ▶if ($help) {
Branch: 1 branch
BranchTrueFalseTotal
if ($help) 0 1 1
25 0 pod2usage(1);
26 0 exit(0);
27 }
28  
29 1 ▶if ($version) {
Branch: 1 branch
BranchTrueFalseTotal
if ($version) 0 1 1
30 0 print $Git::Helpers::VERSION, "\n";
31 0 exit(0);
32 }
33  
34 # https_remote_url( $remote_name, $use_current_branch )
35 1 my $url = https_remote_url( shift @ARGV, $branch );
36 1 ▶die "No browsable URL found for this remote\n" unless $url;
Branch: 1 branch
BranchTrueFalseTotal
unless $url 1 0 1
37 0 ▶if ($echo) {
Branch: 1 branch
BranchTrueFalseTotal
if ($echo) { } 0 0 0
38 0 print $url, "\n";
39 }
40 else {
41 0 open_browser($url);
42 }
43 0 exit;
44  
45 __END__
« blib/lib/Git/Helpers/CPAN.pm ↑ Summary