MooseX:...Command(3)
β¨ MooseX::App::Command β the command-class glow-up guide β¨
okay so bestie, this is the manual page for MooseX::App::Command β it's part of the User Contributed Perl Documentation, and honestly? it's giving "load command class metaclasses" and being the main character of your CLI app. π
πΈ NAME πΈ
MooseX::App::Command β Load command class metaclasses. That's it, that's the vibe. π
π¦ SYNOPSIS π¦
Here's the whole setup, literally copy-paste ready:
package MyApp::SomeCommand;
use MooseX::App::Command; # Also loads Moose
option 'testattr' => (
isa => 'rw',
cmd_tags => [qw(Important! Nice))],
);
command_short_description 'This is a short description';
command_long_description 'This is a much longer description yadda yadda';
command_usage 'script some_command --testattr 123';
no cap, that's the whole flex. β¨
π DESCRIPTION π
so when you load this class into your command classes, you import all the required symbols and unlock all the documentation features β and the list is iconic:
- Parsing command documentation from Pod π
- Setting the command documentation manually via
command_short_descriptionandcommand_long_description - Overriding the automated usage header with custom usage from Pod or via
command_usage - Adding the
cmd_tags,cmd_flag,cmd_aliasesandcmd_typeattributes to options π
π§ FUNCTIONS π§
π command_short_description
Set the short description. If you don't set it, this info gets taken from the Pod NAME or ABSTRACT section. Alternatively, it'll be taken from the DistZilla ABSTRACT tag. (yes, it has backup plans, it's organized like that π«Ά)
π command_long_description
Set the long description. If not set, this information will be taken from the Pod DESCRIPTION or OVERVIEW sections.
π command_usage
Set custom usage. If not set, this'll be taken from the Pod SYNOPSIS or USAGE section. And if those sections aren't available? the usage information gets autogenerated. slay, it handles itself. β¨
π command_strict
command_strict(0); # default
OR
command_strict(1);
If strict is enabled, the program will terminate with an error message if superfluous/unknown positional parameters are supplied. π If it's disabled, all extra parameters will be copied to the extra_argv attribute. no stress, just vibes.
heads up: the app_strict function in the app classes lets you set this option globally. iykyk. π
β sign-off β
this page is perl v5.42.0, dated 2024-08-09, and it's filed under MooseX:...Command(3) in the User Contributed Perl Documentation. go forth and let your commands be iconic π
π₯π
π¦ where this page comes from
- opensuse-leap 16.0: perl-MooseX-App 1.430.1-bp160.1.10 Β· Artistic-1.0 OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms