File Coverage

blib/lib/App/Cme/Command/list.pm
Criterion Covered Total %
statement 23 24 95.8
branch 2 2 100.0
condition 2 2 100.0
subroutine 7 8 87.5
pod 3 3 100.0
total 37 39 94.8


line stmt bran cond sub pod time code
1             #
2             # This file is part of App-Cme
3             #
4             # This software is Copyright (c) 2014-2022 by Dominique Dumont <ddumont@cpan.org>.
5             #
6             # This is free software, licensed under:
7             #
8             # The GNU Lesser General Public License, Version 2.1, February 1999
9             #
10             # ABSTRACT: List applications handled by cme
11              
12             package App::Cme::Command::list ;
13             $App::Cme::Command::list::VERSION = '1.036';
14 1     1   683 use strict;
  1         7  
  1         30  
15 1     1   5 use warnings;
  1         1  
  1         27  
16 1     1   11 use 5.10.1;
  1         3  
17              
18 1     1   4 use App::Cme -command ;
  1         2  
  1         8  
19 1     1   325 use Config::Model::Lister;
  1         3  
  1         308  
20              
21             sub description {
22             return << "EOD"
23             Show a list all applications where a model is available. This list depends on
24             installed Config::Model modules. Applications are divided in 3 categories:
25             - system: for system wide applications (e.g. daemon like sshd)
26             - user: for user applications (e.g. ssh configuration)
27             - application: misc application like multistrap or Debian packaging
28             EOD
29 0     0 1 0 }
30              
31             sub opt_spec {
32 1     1 1 43457 my ( $class, $app ) = @_;
33             return (
34 1         7 [ "dev!" => "list includes a model under development"],
35             );
36             }
37              
38             my %help = (
39             system => "system configuration files. Use sudo to run cme",
40             user => "user configuration files",
41             application => "miscellaneous application configuration",
42             );
43              
44             sub execute {
45 1     1 1 643 my ($self, $opt, $args) = @_;
46              
47 1         4 my ( $categories, $appli_info, $appli_map ) = Config::Model::Lister::available_models($opt->dev());
48 1         1100 foreach my $cat ( qw/system user application/ ) {
49 3   100     44 my $names = $categories->{$cat} || [];
50 3 100       8 next unless @$names;
51 2         14 print $cat," ( ",$help{$cat}," ):\n ", join( "\n ", @$names ), "\n";
52             }
53 1         70 return;
54             }
55              
56             1;
57              
58             __END__
59              
60             =pod
61              
62             =encoding UTF-8
63              
64             =head1 NAME
65              
66             App::Cme::Command::list - List applications handled by cme
67              
68             =head1 VERSION
69              
70             version 1.036
71              
72             =head1 SYNOPSIS
73              
74             cme list
75              
76             =head1 DESCRIPTION
77              
78             Show a list all applications where a model is available. This list depends on
79             installed Config::Model modules.
80              
81             =head1 SEE ALSO
82              
83             L<cme>
84              
85             =head1 AUTHOR
86              
87             Dominique Dumont
88              
89             =head1 COPYRIGHT AND LICENSE
90              
91             This software is Copyright (c) 2014-2022 by Dominique Dumont <ddumont@cpan.org>.
92              
93             This is free software, licensed under:
94              
95             The GNU Lesser General Public License, Version 2.1, February 1999
96              
97             =cut