| 1 | package Langertha::Knarr::CLI::Role::GlobalOptions; | ||||||||||
| 2 | 42 | our $VERSION = '1.103'; | |||||||||
| 3 | # ABSTRACT: Accept knarr's global -c/-v options after the subcommand too | ||||||||||
| 4 | 42 | ▶ | use Moo::Role; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 42 | ▶ | use MooX::Options; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | |||||||||||
| 8 | 42 | option config => ( | |||||||||
| 9 | is => 'ro', | ||||||||||
| 10 | format => 's', | ||||||||||
| 11 | short => 'c', | ||||||||||
| 12 | doc => 'Config file path (default: ./knarr.yaml)', | ||||||||||
| 13 | predicate => 'has_config', | ||||||||||
| 14 | ); | ||||||||||
| 15 | |||||||||||
| 16 | |||||||||||
| 17 | 42 | option verbose => ( | |||||||||
| 18 | is => 'ro', | ||||||||||
| 19 | short => 'v', | ||||||||||
| 20 | doc => 'Enable verbose logging (or set KNARR_DEBUG=1)', | ||||||||||
| 21 | negatable => 1, | ||||||||||
| 22 | predicate => 'has_verbose', | ||||||||||
| 23 | ); | ||||||||||
| 24 | |||||||||||
| 25 | |||||||||||
| 26 | 40 | ▶ | sub config_file { | ||||||||
|
Subroutine
config_file: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||
| 27 | 40 | my ( $self, $chain ) = @_; | |||||||||
| 28 | 40 | ▶ | return $self->has_config ? $self->config : $chain->[0]->config; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 29 | } | ||||||||||
| 30 | |||||||||||
| 31 | |||||||||||
| 32 | 35 | ▶ | sub verbose_enabled { | ||||||||
|
Subroutine
verbose_enabled: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||
| 33 | 35 | my ( $self, $chain ) = @_; | |||||||||
| 34 | 35 | ▶ | return $self->has_verbose ? $self->verbose : $chain->[0]->verbose; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 35 | } | ||||||||||
| 36 | |||||||||||
| 37 | |||||||||||
| 38 | 42 | 1; | |||||||||
| 39 | |||||||||||
| 40 | __END__ | ||||||||||