File Coverage

blib/lib/Boxer/CLI/Command/Aliases.pm
Criterion Covered Total %
statement 30 42 71.4
branch 0 4 0.0
condition n/a
subroutine 11 15 73.3
pod 4 4 100.0
total 45 65 69.2


line stmt bran cond sub pod time code
1             package Boxer::CLI::Command::Aliases;
2              
3             =encoding UTF-8
4              
5             =cut
6              
7 3     3   1940 use v5.20;
  3         8  
8 3     3   15 use utf8;
  3         6  
  3         13  
9 3     3   112 use Role::Commons -all;
  3         5  
  3         14  
10 3     3   4074 use feature 'signatures';
  3         5  
  3         236  
11 3     3   21 use namespace::autoclean 0.16;
  3         43  
  3         16  
12              
13 3     3   181 use match::simple qw(match);
  3         6  
  3         30  
14 3     3   661 use Boxer::CLI -command;
  3         7  
  3         16  
15              
16 3     3   836 use strictures 2;
  3         34  
  3         94  
17 3     3   474 no warnings "experimental::signatures";
  3         3  
  3         175  
18              
19             =head1 VERSION
20              
21             Version v1.4.2
22              
23             =cut
24              
25             our $VERSION = "v1.4.2";
26              
27             use constant {
28 3         1006 abstract => q[show aliases for boxer commands],
29             usage_desc => q[%c aliases],
30 3     3   19 };
  3         5  
31              
32             sub description
33             {
34 0     0 1 0 <<'DESCRIPTION';
35             Some boxer commands can be invoked with shorter aliases.
36              
37             boxer version
38             boxer --version # same thing
39              
40             The aliases command (which, ironically, has no shorter alias) shows existing
41             aliases.
42             DESCRIPTION
43             }
44              
45             sub command_names
46             {
47 5     5 1 26003 qw(
48             aliases
49             );
50             }
51              
52             sub opt_spec
53             {
54 0     0 1   return;
55             }
56              
57 0           sub execute ( $self, $opt, $args )
  0            
58 0     0 1   {
  0            
  0            
59             my $filter
60             = scalar(@$args)
61             ? $args
62 0 0   0     : sub { not( match( shift, [qw(aliases commands help)] ) ) };
  0            
63              
64 0           foreach my $cmd ( sort $self->app->command_plugins ) {
65 0           my ( $preferred, @aliases ) = $cmd->command_names;
66 0 0         printf( "%-16s: %s\n", $preferred, "@aliases" )
67             if match( $preferred, $filter );
68             }
69             }
70              
71             =head1 AUTHOR
72              
73             Jonas Smedegaard C<< <dr@jones.dk> >>.
74              
75             =cut
76              
77             our $AUTHORITY = 'cpan:JONASS';
78              
79             =head1 COPYRIGHT AND LICENCE
80              
81             Copyright © 2013-2016 Jonas Smedegaard
82              
83             This is free software; you can redistribute it and/or modify it under
84             the same terms as the Perl 5 programming language system itself.
85              
86             =head1 DISCLAIMER OF WARRANTIES
87              
88             THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
89             WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
90             MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
91              
92             =cut
93              
94             1;