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