X-Git-Url: http://git.ieval.ro/?p=gruntmaster-data.git;a=blobdiff_plain;f=lib%2FGruntmaster%2FApp%2FCommand.pm;fp=lib%2FGruntmaster%2FApp%2FCommand.pm;h=b1be168dc43c829b5f666d5e70ecf6373b6a7280;hp=0000000000000000000000000000000000000000;hb=63afa40a4691cd73c543ff4f952beceb95db8841;hpb=dfcf2c13edfa774d76f2b917cccc6982e0a0b91b diff --git a/lib/Gruntmaster/App/Command.pm b/lib/Gruntmaster/App/Command.pm new file mode 100644 index 0000000..b1be168 --- /dev/null +++ b/lib/Gruntmaster/App/Command.pm @@ -0,0 +1,61 @@ +package Gruntmaster::App::Command; + +use 5.014000; +use strict; +use warnings; + +our $VERSION = '5999.000_004'; + +use parent qw/App::Cmd::Command/; +use Pod::Usage; + +sub description { + my ($self) = @_; + my ($file) = (ref $self) =~ s,::,/,gr; + my $usage; + open my $fh, '>', \$usage; + pod2usage(-input => $INC{"$file.pm"}, -output => $fh, -exitval => 'NOEXIT', -verbose => 99, -sections => [qw/SYNOPSIS DESCRIPTION/]); + close $fh; + $usage =~ s/Usage:/Usage examples:/; + 1 while chomp $usage; + $usage +} + +1; +__END__ + +=encoding utf-8 + +=head1 NAME + +Gruntmaster::App::Command - Base class for gm commands + +=head1 SYNOPSIS + + package Gruntmaster::App::Command::foo; + use Gruntmaster::App '-command'; + +=head1 DESCRIPTION + +Gruntmaster::App::Command is the base class of all gm commands. Its +only role is to extract a command's documentation from its POD by +overriding the description method to use L. + +=head1 SEE ALSO + +L, L + +=head1 AUTHOR + +Marius Gavrilescu, Emarius@ieval.roE + +=head1 COPYRIGHT AND LICENSE + +Copyright (C) 2015 by Marius Gavrilescu + +This library is free software; you can redistribute it and/or modify +it under the same terms as Perl itself, either Perl version 5.20.1 or, +at your option, any later version of Perl 5 you may have available. + + +=cut