File Coverage

blib/lib/App/DuckPAN/Cmd/Env/Cmd/Rm.pm
Criterion Covered Total %
statement 6 12 50.0
branch 0 4 0.0
condition 0 3 0.0
subroutine 2 3 66.6
pod 0 1 0.0
total 8 23 34.7


line stmt bran cond sub pod time code
1             package App::DuckPAN::Cmd::Env::Cmd::Rm;
2             our $AUTHORITY = 'cpan:DDG';
3             # ABSTRACT: Removes the specified env variable
4             $App::DuckPAN::Cmd::Env::Cmd::Rm::VERSION = '1017';
5 1     1   867 use Moo;
  1         1  
  1         6  
6             with qw( App::DuckPAN::Cmd::Env::Cmd );
7              
8 1     1   223 use MooX::Options protect_argv => 0;
  1         1  
  1         5  
9              
10             sub run {
11 0     0 0   my ( $self, $name ) = @_;
12 0 0         $self->env->help("<name>") if !$name;
13 0           my $data = $self->env->load_env_ini;
14 0           $name = uc $name;
15 0 0 0       defined $data->{$name} ? delete $data->{$name} && $self->root->emit_info("Successfully removed '". $name ."'!") : $self->root->emit_error("'". $name ."' not found!");
16 0           $self->env->save_env_ini($data);
17             }
18              
19             1;
20              
21             __END__
22              
23             =pod
24              
25             =head1 NAME
26              
27             App::DuckPAN::Cmd::Env::Cmd::Rm - Removes the specified env variable
28              
29             =head1 VERSION
30              
31             version 1017
32              
33             =head1 AUTHOR
34              
35             DuckDuckGo <open@duckduckgo.com>, Zach Thompson <zach@duckduckgo.com>, Zaahir Moolla <moollaza@duckduckgo.com>, Torsten Raudssus <torsten@raudss.us> L<https://raudss.us/>
36              
37             =head1 COPYRIGHT AND LICENSE
38              
39             This software is Copyright (c) 2013 by DuckDuckGo, Inc. L<https://duckduckgo.com/>.
40              
41             This is free software, licensed under:
42              
43             The Apache License, Version 2.0, January 2004
44              
45             =cut