NAME
Langertha::Knarr::CLI::Role::GlobalOptions - Accept knarr's global -c/-v options after the subcommand too
VERSION
version 1.102
DESCRIPTION
MooX::Cmd hands every argument before the subcommand name to Langertha::Knarr::CLI and every argument after it to the subcommand, so the global -c/--config and -v/--verbose options would only work in front of the subcommand (knarr -c prod.yaml start). Composing this role into a subcommand declares the same two options there as well, so the documented form knarr start -c prod.yaml -v works too.
A value given after the subcommand wins over one given before it. Commands read the effective values through "config_file" and "verbose_enabled", never through the global object directly.
--config
Same as the global -c/--config, accepted after the subcommand.
--verbose
Same as the global -v/--verbose, accepted after the subcommand. --no-verbose switches it off again, also against KNARR_DEBUG=1.
config_file
my $file = $self->config_file($chain);
Returns the config file path: the subcommand's own --config when given, otherwise the global one from the first element of the MooX::Cmd command chain (which carries the ./knarr.yaml default).
verbose_enabled
Log::Any::Adapter->set( 'Stderr',
log_level => $self->verbose_enabled($chain) ? 'trace' : 'warning' );
Returns whether verbose logging is on: the subcommand's own --verbose/--no-verbose when given, otherwise the global setting.
SUPPORT
Issues
Please report bugs and feature requests on GitHub at https://github.com/Getty/langertha-knarr/issues.
IRC
Join #langertha on irc.perl.org or message Getty directly.
CONTRIBUTING
Contributions are welcome! Please fork the repository and submit a pull request.
AUTHOR
Torsten Raudssus <torsten@raudssus.de> https://raudssus.de/
COPYRIGHT AND LICENSE
This software is copyright (c) 2026 by Torsten Raudssus.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.