File: list.pm

package info (click to toggle)
cme 1.043-2
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 392 kB
  • sloc: perl: 1,293; makefile: 19; sh: 9
file content (63 lines) | stat: -rw-r--r-- 1,464 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# ABSTRACT: List applications handled by cme

package App::Cme::Command::list ;

use strict;
use warnings;
use 5.10.1;

use App::Cme -command ;
use Config::Model::Lister;

sub description {
    return << "EOD"
Show a list all applications where a model is available. This list depends on
installed Config::Model modules. Applications are divided in 3 categories:
- system: for system wide applications (e.g. daemon like sshd)
- user: for user applications (e.g. ssh configuration)
- application: misc application like multistrap or Debian packaging
EOD
}

sub opt_spec {
    my ( $class, $app ) = @_;
    return (
        [ "dev!"               => "list includes a model under development"],
    );
}

my %help = (
    system => "system configuration files. Use sudo to run cme",
    user => "user configuration files",
    application => "miscellaneous application configuration",
);

sub execute {
    my ($self, $opt, $args) = @_;

    my ( $categories, $appli_info, $appli_map ) = Config::Model::Lister::available_models($opt->dev());
    foreach my $cat ( qw/system user application/ ) {
        my $names = $categories->{$cat} || [];
        next unless @$names;
        print $cat," ( ",$help{$cat}," ):\n  ", join( "\n  ", @$names ), "\n";
    }
    return;
}

1;


=head1 SYNOPSIS

 cme list

=head1 DESCRIPTION

Show a list all applications where a model is available. This list depends on
installed Config::Model modules.

=head1 SEE ALSO

L<cme>

=cut