Kusarigama/App/Add.pm

filter: Statementstmt 76.7% 33 / 43 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 90.9% 10 / 11 Podpod n/a totaltotal 79.6% 43 / 54 CC 2 SCAR 6.1
CC
2
Cov
77%
run
6.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.8
« Kusarigama/Plugin/Renew.pm ↑ Summary Kusarigama/Plugin/ProjectAlias.pm »
1 package Taskwarrior::Kusarigama::App::Add;
2 1 our $AUTHORITY = 'cpan:YANICK';
3 # ABSTRACT: Add plugins to Taskwarrior
4 1 $Taskwarrior::Kusarigama::App::Add::VERSION = '0.11.0';
5  
6 1 ▶use 5.10.0;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 1 ▶use List::AllUtils qw/ uniq /;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 ▶use Set::Object qw/ set /;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 1 ▶use Module::Runtime qw/ use_module /;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 1 ▶use Taskwarrior::Kusarigama;
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 1 ▶use MooseX::App::Command;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 1 ▶use MooseX::MungeHas;
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 1 ▶use experimental 'postderef';
Subroutine BEGIN: called CC=1 SCAR=0.0
21  
22 1 extends 'Taskwarrior::Kusarigama::App';
23  
24 sub run {
25 0 ▶ my $self = shift;
Subroutine run: not called CC=2 SCAR=17.9
26  
27 0 my $old_plugins = set( map { $_->name } $self->tw->plugins->@* );
28  
29 0 my $new_plugins = set($self->extra_argv->@*) - $old_plugins;
30  
31 0 my $plugins = $old_plugins + $new_plugins;
32  
33 0 say "setting plugins to ", join ', ', @$plugins;
34  
35 0 $self->tw->run_task->config( [{ 'rc.confirmation' => 'off' }], 'kusarigama.plugins', join ',', @$plugins );
36  
37 0 $_->new( tw => $self->tw )->setup for
38 0 grep { use_module($_)->can('setup') }
39 0 map { "Taskwarrior::Kusarigama::Plugin::$_" }
40 @$new_plugins;
41  
42 }
43  
44 1 1;
45  
46 __END__
47  
48 =pod
49  
50 =encoding UTF-8
51  
52 =head1 NAME
53  
54 Taskwarrior::Kusarigama::App::Add - Add plugins to Taskwarrior
55  
56 =head1 VERSION
57  
58 version 0.11.0
59  
60 =head1 SYNOPSIS
61  
62 $ task-kusarigama add Command::Open Renew
63  
64 =head1 AUTHOR
65  
66 Yanick Champoux <yanick@cpan.org>
67  
68 =head1 COPYRIGHT AND LICENSE
69  
70 This software is copyright (c) 2018, 2017 by Yanick Champoux.
71  
72 This is free software; you can redistribute it and/or modify it under
73 the same terms as the Perl 5 programming language system itself.
74  
75 =cut
« Kusarigama/Plugin/Renew.pm ↑ Summary Kusarigama/Plugin/ProjectAlias.pm »