Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Put the bulk of the code into App::Grok * Bundle a share/ dir
- Loading branch information
Showing
4 changed files
with
41 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
script/grok | ||
lib/App/Grok.pm | ||
script/grok.pod | ||
p6/grok | ||
Makefile.PL | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package App::Grok; | ||
|
||
# blows up if we use strict before this, damn source filter | ||
use Perl6::Perldoc::Parser; | ||
|
||
use strict; | ||
use warnings; | ||
use Getopt::Long qw(:config bundling); | ||
use Pod::Usage; | ||
|
||
our $VERSION = '0.03'; | ||
|
||
sub run { | ||
GetOptions( | ||
'F|file=s' => \my $from_file, | ||
'f|format=s' => \(my $format = 'ansi'), | ||
'h|help' => sub { pod2usage(1) }, | ||
'v|version' => sub { print "grok $VERSION\n"; exit }, | ||
) or pod2usage(); | ||
|
||
if (!defined $from_file) { | ||
die "You must supply --file with an argument; see --help\n"; | ||
} | ||
|
||
if ($format ne 'text' && $format ne 'ansi') { | ||
die "Format '$format' is unsupported\n"; | ||
} | ||
|
||
$format eq 'text' | ||
? require Perl6::Perldoc::To::Text | ||
: require Perl6::Perldoc::To::Ansi | ||
; | ||
|
||
print Perl6::Perldoc::Parser->parse($from_file, {all_pod=>'auto'}) | ||
->report_errors() | ||
->to_text(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters