File Coverage

blib/lib/WWW/GoDaddy/REST/Shell/ListCommand.pm
Criterion Covered Total %
statement 12 35 34.2
branch n/a
condition n/a
subroutine 4 8 50.0
pod 0 4 0.0
total 16 47 34.0


line stmt bran cond sub pod time code
1             package WWW::GoDaddy::REST::Shell::ListCommand;
2              
3 1     1   4 use strict;
  1         2  
  1         27  
4 1     1   4 use warnings;
  1         1  
  1         39  
5              
6 1         8 use Sub::Exporter -setup => {
7             exports => [qw(run_list smry_list help_list alias_list)],
8             groups => { default => [qw(run_list smry_list help_list alias_list)] }
9 1     1   4 };
  1         1  
10 1     1   755 use Text::Wrap qw(wrap);
  1         1992  
  1         232  
11              
12             sub run_list {
13 0     0 0   my ($self) = @_;
14              
15 0           my $schemas = $self->client->schemas();
16              
17 0           my @queryable = sort map { $_->id } grep { $_->is_queryable } @{$schemas};
  0            
  0            
  0            
18 0           my @not_queryable = sort map { $_->id } grep { !$_->is_queryable } @{$schemas};
  0            
  0            
  0            
19              
20 0           local $Text::Wrap::columns = $self->termsize->{cols};
21              
22 0           my $output = '';
23              
24 0           my $tab = ' ';
25              
26 0           $output .= wrap( '', '', "Schemas that you can query:\n\n" );
27 0           $output .= wrap( $tab, $tab, join " ", @queryable );
28              
29 0           $output .= wrap( '', '', "\n\nOther:\n\n" );
30 0           $output .= wrap( $tab, $tab, join " ", @not_queryable );
31 0           $output .= "\n";
32              
33 0           $self->page($output);
34              
35 0           return 1;
36             }
37              
38             sub smry_list {
39 0     0 0   return "list the available schema";
40             }
41              
42             sub help_list {
43             return <<HELP
44             List all the available data types that are available to work with.
45              
46             Usage:
47             list
48             HELP
49 0     0 0   }
50              
51             sub alias_list {
52 0     0 0   return ('ls');
53             }
54              
55             1;
56              
57             =head1 AUTHOR
58              
59             David Bartle, C<< <davidb@mediatemple.net> >>
60              
61             =head1 COPYRIGHT & LICENSE
62              
63             Copyright (c) 2014 Go Daddy Operating Company, LLC
64              
65             Permission is hereby granted, free of charge, to any person obtaining a
66             copy of this software and associated documentation files (the "Software"),
67             to deal in the Software without restriction, including without limitation
68             the rights to use, copy, modify, merge, publish, distribute, sublicense,
69             and/or sell copies of the Software, and to permit persons to whom the
70             Software is furnished to do so, subject to the following conditions:
71              
72             The above copyright notice and this permission notice shall be included in
73             all copies or substantial portions of the Software.
74              
75             THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
76             IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
77             FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
78             THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
79             LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
80             FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
81             DEALINGS IN THE SOFTWARE.
82              
83             =cut