App-ShellCheckWiki

 view release on metacpan or  search on metacpan

lib/App/ShellCheckWiki.pm  view on Meta::CPAN

use 5.006;
use strict;
use warnings;

use Term::ANSIColor;
use WWW::Mechanize;

our $VERSION = '0.03';

my $formats = {
    '# '   => 'bold green',   # H1
    '## '  => 'bold magenta', # H2
    '### ' => 'bold red',     # H3
    '```'  => 'yellow',       # Code Block
};

my $wiki_url = 'https://raw.githubusercontent.com/wiki/koalaman/shellcheck';
my $wiki_toc = 'https://github.com/koalaman/shellcheck/wiki';

my $mech = WWW::Mechanize->new( autocheck => 0 );

sub run {
    my $page = $ARGV[0];

lib/App/ShellCheckWiki.pm  view on Meta::CPAN


sub starts_with {
    my ($line, $format) = @_;
    return unless length($line) >= length($format);
    my $start = substr($line,0,length($format),'');
    return unless $start eq $format;
    return $line;
}

sub show_topics {
    print colored(['bold magenta'], "Checking for Available Topics: ");
    print colored(['green'], "SCxxxx\n");
    $mech->get($wiki_toc);
    my $topics = {};
    if ($mech->success()) {
        for my $link ($mech->links()) {
            next unless $link->url =~ m|SC(\d+)|;
            $topics->{$1}++;
        }
        my @ranges = number_range( keys %$topics );
        for my $range (@ranges) {



( run in 0.999 second using v1.01-cache-2.11-cpan-c333fce770f )