| 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 | 1 | $App::Cme::Command::list::VERSION = '1.049'; | |||||||||||
| 14 | 1 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 15 | 1 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 16 | 1 | ▶ | use 5.10.1; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 17 | |||||||||||||
| 18 | 1 | ▶ | use App::Cme -command ; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 19 | 1 | ▶ | use Config::Model::Lister; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 20 | |||||||||||||
| 21 | 0 | ▶ | sub description { | ||||||||||
|
Subroutine
description: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 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 Debian packaging | ||||||||||||
| 28 | EOD | ||||||||||||
| 29 | 0 | } | |||||||||||
| 30 | |||||||||||||
| 31 | 1 | ▶ | sub opt_spec { | ||||||||||
|
Subroutine
opt_spec: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||
| 32 | 1 | my ( $class, $app ) = @_; | |||||||||||
| 33 | return ( | ||||||||||||
| 34 | 1 | [ "dev!" => "list includes a model under development"], | |||||||||||
| 35 | ); | ||||||||||||
| 36 | } | ||||||||||||
| 37 | |||||||||||||
| 38 | 1 | 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 | 1 | ▶ | sub execute { | ||||||||||
|
Subroutine
execute: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||
| 45 | 1 | my ($self, $opt, $args) = @_; | |||||||||||
| 46 | |||||||||||||
| 47 | 1 | my ( $categories, $appli_info, $appli_map ) = Config::Model::Lister::available_models($opt->dev()); | |||||||||||
| 48 | 1 | foreach my $cat ( qw/system user application/ ) { | |||||||||||
| 49 | 3 | ▶ | my $names = $categories->{$cat} || []; | ||||||||||
|
Condition100%2/2
$categories->{$cat} || []
MC/DC100%1/1
$categories->{$cat} || []
$categories->{$cat}
Truth table100%2/2
A
A= $categories->{$cat}
| |||||||||||||
| 50 | 3 | ▶ | next unless @$names; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 51 | 2 | print $cat," ( ",$help{$cat}," ):\n ", join( "\n ", @$names ), "\n"; | |||||||||||
| 52 | } | ||||||||||||
| 53 | 1 | return; | |||||||||||
| 54 | } | ||||||||||||
| 55 | |||||||||||||
| 56 | 1 | 1; | |||||||||||
| 57 | |||||||||||||
| 58 | __END__ | ||||||||||||