File Coverage

blib/lib/App/Cme/Command/shell.pm
Criterion Covered Total %
statement 14 34 41.1
branch 0 2 0.0
condition n/a
subroutine 5 10 50.0
pod 5 5 100.0
total 24 51 47.0


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: Edit the configuration of an application with a shell
11              
12             package App::Cme::Command::shell ;
13             $App::Cme::Command::shell::VERSION = '1.036';
14 1     1   774 use strict;
  1         3  
  1         32  
15 1     1   6 use warnings;
  1         7  
  1         25  
16 1     1   11 use 5.10.1;
  1         4  
17              
18 1     1   4 use App::Cme -command ;
  1         2  
  1         6  
19              
20 1     1   364 use base qw/App::Cme::Common/;
  1         2  
  1         441  
21              
22             sub validate_args {
23 0     0 1   my ($self, $opt, $args) = @_;
24 0           $self->check_unknown_args($args);
25 0           $self->process_args($opt,$args);
26 0           return;
27             }
28              
29             sub opt_spec {
30 0     0 1   my ( $class, $app ) = @_;
31             return (
32 0           [ "open-item=s" => "open a specific item of the configuration" ],
33             [ "backup:s" => "Create a backup of configuration files before saving." ],
34             [ "bare!" => "run bare terminal UI"],
35             $class->cme_global_options,
36             );
37             }
38              
39             sub usage_desc {
40 0     0 1   my ($self) = @_;
41 0           my $desc = $self->SUPER::usage_desc; # "%c COMMAND %o"
42 0           return "$desc [application] [file ]";
43             }
44              
45             sub description {
46 0     0 1   my ($self) = @_;
47 0           return $self->get_documentation;
48             }
49              
50             sub execute {
51 0     0 1   my ($self, $opt, $args) = @_;
52              
53 0           my ($model, $inst, $root) = $self->init_cme($opt,$args);
54              
55 0           $root->deep_check;
56              
57 0 0         if ($opt->{bare}) {
58 0           require Config::Model::SimpleUI;
59 0           $self->run_shell_ui('Config::Model::SimpleUI', $inst) ;
60             }
61             else {
62 0           require Config::Model::TermUI;
63 0           $self->run_shell_ui('Config::Model::TermUI', $inst) ;
64             }
65              
66 0           return;
67             }
68              
69             1;
70              
71             __END__
72              
73             =pod
74              
75             =encoding UTF-8
76              
77             =head1 NAME
78              
79             App::Cme::Command::shell - Edit the configuration of an application with a shell
80              
81             =head1 VERSION
82              
83             version 1.036
84              
85             =head1 SYNOPSIS
86              
87             # simple shell like interface
88             cme shell dpkg-copyright
89              
90             =head1 DESCRIPTION
91              
92             Edit the configuration with a shell like interface. See L<Config::Model::TermUI>
93             for details. This is a shortcut for C<cme edit -ui shell>. See L<App::Cme::Command::shell>.
94              
95             =head1 Common options
96              
97             See L<cme/"Global Options">.
98              
99             =head1 options
100              
101             =over
102              
103             =item -open-item
104              
105             Open a specific item of the configuration when opening the editor
106              
107             =item -bare
108              
109             Use Term UI without auto-completion or font enhancements.
110              
111             =back
112              
113             =head1 SEE ALSO
114              
115             L<cme>
116              
117             =head1 AUTHOR
118              
119             Dominique Dumont
120              
121             =head1 COPYRIGHT AND LICENSE
122              
123             This software is Copyright (c) 2014-2022 by Dominique Dumont <ddumont@cpan.org>.
124              
125             This is free software, licensed under:
126              
127             The GNU Lesser General Public License, Version 2.1, February 1999
128              
129             =cut