Update to current Perl
This commit is contained in:
parent
ebd46d86d4
commit
3cc88f8150
57 changed files with 11638 additions and 665 deletions
78
lib/WGDev/Command/Help.pm
Normal file
78
lib/WGDev/Command/Help.pm
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
package WGDev::Command::Help;
|
||||
# ABSTRACT: Displays C<perldoc> help for WGDev command
|
||||
use strict;
|
||||
use warnings;
|
||||
use 5.008008;
|
||||
|
||||
use parent qw(WGDev::Command::Base);
|
||||
|
||||
use WGDev::Command ();
|
||||
use WGDev::X ();
|
||||
|
||||
sub needs_root {
|
||||
return;
|
||||
}
|
||||
|
||||
sub process {
|
||||
my $self = shift;
|
||||
my $wgd = $self->wgd;
|
||||
|
||||
my ($command) = $self->arguments;
|
||||
if ( !defined $command ) {
|
||||
print WGDev::Command->usage(1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
my $command_module;
|
||||
if ( $command eq 'wgd' ) {
|
||||
$command_module = 'WGDev::Command';
|
||||
}
|
||||
else {
|
||||
$command_module = WGDev::Command->get_command_module($command);
|
||||
}
|
||||
|
||||
if ( !$command_module ) {
|
||||
WGDev::X::CommandLine::BadCommand->throw(
|
||||
usage => $self->usage,
|
||||
command_name => $command,
|
||||
);
|
||||
}
|
||||
|
||||
if ( $command_module->can('help') ) {
|
||||
return $command_module->help;
|
||||
}
|
||||
|
||||
require WGDev::Help;
|
||||
WGDev::Help::package_perldoc( $command_module,
|
||||
'!AUTHOR|LICENSE|METHODS|SUBROUTINES' );
|
||||
return 1;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
wgd help <command>
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Displays C<perldoc> page for WGDev command.
|
||||
|
||||
More or less equivalent to running
|
||||
|
||||
wgd command --help
|
||||
|
||||
Except that the help message is displayed via Pod::Perldoc
|
||||
|
||||
=head1 OPTIONS
|
||||
|
||||
=over 8
|
||||
|
||||
=item C<< <command> >>
|
||||
|
||||
The sub-command to display help information about.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue