| 1 | # | ||||||||||
| 2 | # This file is part of App-Magpie | ||||||||||
| 3 | # | ||||||||||
| 4 | # This software is copyright (c) 2011 by Jerome Quelin. | ||||||||||
| 5 | # | ||||||||||
| 6 | # This is free software; you can redistribute it and/or modify it under | ||||||||||
| 7 | # the same terms as the Perl 5 programming language system itself. | ||||||||||
| 8 | # | ||||||||||
| 9 | 1 | ▶ | use 5.012; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 12 | |||||||||||
| 13 | package App::Magpie::App::Command::config; | ||||||||||
| 14 | # ABSTRACT: update a spec file to match some policies | ||||||||||
| 15 | 1 | $App::Magpie::App::Command::config::VERSION = '2.010'; | |||||||||
| 16 | 1 | ▶ | use App::Magpie::App -command; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 17 | |||||||||||
| 18 | 1 | ▶ | use App::Magpie::Config; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 19 | |||||||||||
| 20 | |||||||||||
| 21 | # -- public methods | ||||||||||
| 22 | |||||||||||
| 23 | 0 | ▶ | sub description { | ||||||||
|
Subroutine
description: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 24 | 0 | "Store some configuration items, to avoid repeating them over and over | |||||||||
| 25 | as command-line options." | ||||||||||
| 26 | } | ||||||||||
| 27 | |||||||||||
| 28 | 0 | ▶ | sub opt_spec { | ||||||||
|
Subroutine
opt_spec: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 29 | 0 | my $self = shift; | |||||||||
| 30 | return ( | ||||||||||
| 31 | 0 | [], | |||||||||
| 32 | [ "dump|D", "dump whole configuration" ], | ||||||||||
| 33 | [], | ||||||||||
| 34 | [ "Available configuration items" ], | ||||||||||
| 35 | [ "log-level|l=i", "default logging level", ] | ||||||||||
| 36 | ); | ||||||||||
| 37 | } | ||||||||||
| 38 | |||||||||||
| 39 | 0 | ▶ | sub execute { | ||||||||
|
Subroutine
execute: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||
| 40 | 0 | my ($self, $opts, $args) = @_; | |||||||||
| 41 | 0 | my $config = App::Magpie::Config->instance; | |||||||||
| 42 | |||||||||||
| 43 | 0 | ▶ | if ( $opts->{dump} ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 44 | 0 | say $config->dump; | |||||||||
| 45 | 0 | exit; | |||||||||
| 46 | } | ||||||||||
| 47 | |||||||||||
| 48 | 0 | ▶ | if ( exists $opts->{log_level} ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 49 | 0 | $config->set( "log", "level", $opts->{log_level} ); | |||||||||
| 50 | } | ||||||||||
| 51 | } | ||||||||||
| 52 | |||||||||||
| 53 | 1 | 1; | |||||||||
| 54 | |||||||||||
| 55 | __END__ | ||||||||||