1App::Cmd::Command::helpU(s3e)r Contributed Perl DocumentaAtpipo:n:Cmd::Command::help(3)
2
3
4
6 App::Cmd::Command::help - display a command's help screen
7
9 version 0.334
10
12 This command will either list all of the application commands and their
13 abstracts, or display the usage screen for a subcommand with its
14 description.
15
17 This module has a long-term perl support period. That means it will
18 not require a version of perl released fewer than five years ago.
19
20 Although it may work on older versions of perl, no guarantee is made
21 that the minimum required version will not be increased. The version
22 may be increased for any reason, and there is no promise that patches
23 will be accepted to lower the minimum required perl.
24
26 The help text is generated from three sources:
27
28 • The "usage_desc" method
29
30 • The "description" method
31
32 • The "opt_spec" data structure
33
34 The "usage_desc" method provides the opening usage line, following the
35 specification described in Getopt::Long::Descriptive. In some cases,
36 the default "usage_desc" in App::Cmd::Command may be sufficient and you
37 will only need to override it to provide additional command line usage
38 information.
39
40 The "opt_spec" data structure is used with Getopt::Long::Descriptive to
41 generate the description of the options.
42
43 Subcommand classes should override the "discription" method to provide
44 additional information that is prepended before the option
45 descriptions.
46
47 For example, consider the following subcommand module:
48
49 package YourApp::Command::initialize;
50
51 # This is the default from App::Cmd::Command
52 sub usage_desc {
53 my ($self) = @_;
54 my $desc = $self->SUPER::usage_desc; # "%c COMMAND %o"
55 return "$desc [DIRECTORY]";
56 }
57
58 sub description {
59 return "The initialize command prepares the application...";
60 }
61
62 sub opt_spec {
63 return (
64 [ "skip-refs|R", "skip reference checks during init", ],
65 [ "values|v=s@", "starting values", { default => [ 0, 1, 3 ] } ],
66 );
67 }
68
69 ...
70
71 That module would generate help output like this:
72
73 $ yourapp help initialize
74 yourapp initialize [-Rv] [long options...] [DIRECTORY]
75
76 The initialize command prepares the application...
77
78 --help This usage screen
79 -R --skip-refs skip reference checks during init
80 -v --values starting values
81
83 Ricardo Signes <rjbs@semiotic.systems>
84
86 This software is copyright (c) 2021 by Ricardo Signes.
87
88 This is free software; you can redistribute it and/or modify it under
89 the same terms as the Perl 5 programming language system itself.
90
91
92
93perl v5.34.0 2022-01-20 App::Cmd::Command::help(3)