File Coverage

blib/lib/App/Git/Workflow/Command/RemoteDelete.pm
Criterion Covered Total %
statement 21 33 63.6
branch 0 12 0.0
condition n/a
subroutine 7 8 87.5
pod 1 1 100.0
total 29 54 53.7


line stmt bran cond sub pod time code
1              
2             # Created on: 2014-03-11 20:58:59
3             # Create by: Ivan Wills
4             # $Id$
5             # $Revision$, $HeadURL$, $Date$
6             # $Revision$, $Source$, $Date$
7              
8             use strict;
9 1     1   1093 use warnings;
  1         3  
  1         32  
10 1     1   6 use version;
  1         3  
  1         23  
11 1     1   4 use English qw/ -no_match_vars /;
  1         2  
  1         6  
12 1     1   67 use Term::ANSIColor qw/colored/;
  1         2  
  1         7  
13 1     1   310 use App::Git::Workflow;
  1         2  
  1         35  
14 1     1   4 use App::Git::Workflow::Command qw/get_options/;
  1         2  
  1         34  
15 1     1   6  
  1         1  
  1         296  
16             our $VERSION = version->new(1.1.20);
17             our $workflow = App::Git::Workflow->new;
18             our ($name) = $PROGRAM_NAME =~ m{^.*/(.*?)$}mxs;
19             our %option = (
20             remote => 'origin',
21             branches => [],
22             );
23              
24             get_options(
25             \%option,
26 0     0 1   'local|l',
27             'force|f!',
28             'no_verify|no-verify|n',
29             );
30              
31             if (@ARGV > 1 ) {
32             ($option{remote}, @{$option{branches}}) = @ARGV;
33 0 0         }
34 0           else {
  0            
35             $option{branches}[0] = shift @ARGV;
36             }
37 0            
38             for my $branch (@{ $option{branches} }) {
39             if ($option{verbose}) {
40 0           warn "git push ".($option{no_verify} ? '--no-verify' : ()). " --delete $option{remote} $branch\n";
  0            
41 0 0         }
42 0 0          
43             $workflow->git->push(($option{no_verify} ? '--no-verify' : ()), '--delete', $option{remote}, $branch);
44              
45 0 0         if ( $option{local} ) {
46             $workflow->git->branch('-d', ($option{force} ? '-f' : ()), $branch);
47 0 0         }
48 0 0         }
49             }
50              
51             1;
52              
53              
54             =head1 NAME
55              
56             git-remote-delete - Delete remote branches
57              
58             =head1 VERSION
59              
60             This documentation refers to git-remote-delete version 1.1.20
61              
62             =head1 SYNOPSIS
63              
64             git-remote-delete [option] [remote-name]
65              
66             OPTIONS:
67             remote-name The name of the remote to delete from (Default origin)
68              
69             -l --local Also delete the local branch
70             -f --force Force delete if local branch is out of date
71             -n --no-verify
72             Don't run git pre-push hooks
73              
74             -v --verbose Show more detailed option
75             --version Prints the version information
76             --help Prints this help information
77             --man Prints the full documentation for git-remote-delete
78              
79             =head1 DESCRIPTION
80              
81             Short hand for running
82              
83             C<git push origin --delete 'branch'>
84              
85             =head1 SUBROUTINES/METHODS
86              
87             =head2 C<run ()>
88              
89             Executes the git workflow command
90              
91             =head1 DIAGNOSTICS
92              
93             =head1 CONFIGURATION AND ENVIRONMENT
94              
95             =head1 DEPENDENCIES
96              
97             =head1 INCOMPATIBILITIES
98              
99             =head1 BUGS AND LIMITATIONS
100              
101             There are no known bugs in this module.
102              
103             Please report problems to Ivan Wills (ivan.wills@gmail.com).
104              
105             Patches are welcome.
106              
107             =head1 AUTHOR
108              
109             Ivan Wills - (ivan.wills@gmail.com)
110              
111             =head1 LICENSE AND COPYRIGHT
112              
113             Copyright (c) 2014 Ivan Wills (14 Mullion Close, Hornsby Heights, NSW Australia 2077).
114             All rights reserved.
115              
116             This module is free software; you can redistribute it and/or modify it under
117             the same terms as Perl itself. See L<perlartistic>. This program is
118             distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
119             without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
120             PARTICULAR PURPOSE.
121              
122             =cut