line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::GitGot::Command::tag; |
2
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:GENEHACK'; |
3
|
|
|
|
|
|
|
$App::GitGot::Command::tag::VERSION = '1.339'; |
4
|
|
|
|
|
|
|
# ABSTRACT: list/add/remove tags for the current repository |
5
|
15
|
|
|
15
|
|
8762
|
use 5.014; |
|
15
|
|
|
|
|
59
|
|
6
|
|
|
|
|
|
|
|
7
|
15
|
|
|
15
|
|
89
|
use Moo; |
|
15
|
|
|
|
|
46
|
|
|
15
|
|
|
|
|
93
|
|
8
|
|
|
|
|
|
|
extends 'App::GitGot::Command'; |
9
|
15
|
|
|
15
|
|
5311
|
use namespace::autoclean; |
|
15
|
|
|
|
|
40
|
|
|
15
|
|
|
|
|
122
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub options { |
12
|
7
|
|
|
7
|
0
|
631
|
my( $class , $app ) = @_; |
13
|
|
|
|
|
|
|
return ( |
14
|
7
|
|
|
|
|
113
|
[ 'add|a' => 'assign tags to the current repository' => { default => 0 } ] , |
15
|
|
|
|
|
|
|
[ 'all|A' => 'print out tags of all repositories' => { default => 0 } ] , |
16
|
|
|
|
|
|
|
[ 'remove|rm' => 'remove tags from the current repository' => { default => 0 } ] , |
17
|
|
|
|
|
|
|
); |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub _execute { |
21
|
7
|
|
|
7
|
|
25
|
my( $self, $opt, $args ) = @_; |
22
|
|
|
|
|
|
|
|
23
|
7
|
50
|
|
|
|
37
|
return say "not in a got-monitored repo" unless $self->local_repo; |
24
|
|
|
|
|
|
|
|
25
|
6
|
100
|
100
|
|
|
333
|
return say "can't --add and --remove at the same time" |
26
|
|
|
|
|
|
|
if $self->opt->add and $self->opt->remove; |
27
|
|
|
|
|
|
|
|
28
|
5
|
100
|
|
|
|
59
|
if( $self->opt->add ) { |
29
|
1
|
|
|
|
|
8
|
return $self->_add_tags( @$args ); |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
4
|
100
|
|
|
|
49
|
if( $self->opt->remove ) { |
33
|
1
|
|
|
|
|
9
|
return $self->_remove_tags( @$args ); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
3
|
|
|
|
|
21
|
$self->_print_tags; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub _add_tags { |
40
|
1
|
|
|
1
|
|
5
|
my( $self, @tags ) = @_; |
41
|
|
|
|
|
|
|
|
42
|
1
|
|
|
|
|
4
|
$self->local_repo->add_tags( @tags ); |
43
|
|
|
|
|
|
|
|
44
|
1
|
|
|
|
|
76
|
$self->write_config; |
45
|
|
|
|
|
|
|
|
46
|
1
|
|
|
|
|
2308
|
say "tags added"; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub _print_tags { |
50
|
3
|
|
|
3
|
|
7
|
my $self = shift; |
51
|
|
|
|
|
|
|
|
52
|
3
|
|
|
|
|
11
|
my %tags = map { $_ => 1 } split ' ', $self->local_repo->tags; |
|
3
|
|
|
|
|
126
|
|
53
|
|
|
|
|
|
|
|
54
|
3
|
50
|
|
|
|
100
|
if ( $self->opt->all ) { |
55
|
0
|
|
0
|
|
|
0
|
$tags{$_} ||= 0 for map { split ' ', $_->tags } $self->all_repos |
|
0
|
|
|
|
|
0
|
|
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
3
|
|
|
|
|
68
|
for my $t ( sort keys %tags ) { |
59
|
3
|
|
33
|
|
|
37
|
say $t, ' *' x ( $self->opt->all and $tags{$t} ); |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub _remove_tags { |
65
|
1
|
|
|
1
|
|
3
|
my( $self, @tags ) = @_; |
66
|
|
|
|
|
|
|
|
67
|
1
|
|
|
|
|
5
|
$self->local_repo->remove_tags(@tags); |
68
|
|
|
|
|
|
|
|
69
|
1
|
|
|
|
|
46
|
$self->write_config; |
70
|
|
|
|
|
|
|
|
71
|
1
|
|
|
|
|
2100
|
say "tags removed"; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
1; |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
__END__ |