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.331
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 The help text is generated from three sources:
18
19 · The "usage_desc" method
20
21 · The "description" method
22
23 · The "opt_spec" data structure
24
25 The "usage_desc" method provides the opening usage line, following the
26 specification described in Getopt::Long::Descriptive. In some cases,
27 the default "usage_desc" in App::Cmd::Command may be sufficient and you
28 will only need to override it to provide additional command line usage
29 information.
30
31 The "opt_spec" data structure is used with Getopt::Long::Descriptive to
32 generate the description of the options.
33
34 Subcommand classes should override the "discription" method to provide
35 additional information that is prepended before the option
36 descriptions.
37
38 For example, consider the following subcommand module:
39
40 package YourApp::Command::initialize;
41
42 # This is the default from App::Cmd::Command
43 sub usage_desc {
44 my ($self) = @_;
45 my $desc = $self->SUPER::usage_desc; # "%c COMMAND %o"
46 return "$desc [DIRECTORY]";
47 }
48
49 sub description {
50 return "The initialize command prepares the application...";
51 }
52
53 sub opt_spec {
54 return (
55 [ "skip-refs|R", "skip reference checks during init", ],
56 [ "values|v=s@", "starting values", { default => [ 0, 1, 3 ] } ],
57 );
58 }
59
60 ...
61
62 That module would generate help output like this:
63
64 $ yourapp help initialize
65 yourapp initialize [-Rv] [long options...] [DIRECTORY]
66
67 The initialize command prepares the application...
68
69 --help This usage screen
70 -R --skip-refs skip reference checks during init
71 -v --values starting values
72
74 Ricardo Signes <rjbs@cpan.org>
75
77 This software is copyright (c) 2016 by Ricardo Signes.
78
79 This is free software; you can redistribute it and/or modify it under
80 the same terms as the Perl 5 programming language system itself.
81
82
83
84perl v5.30.1 2020-01-29 App::Cmd::Command::help(3)