App-Cheats
view release on metacpan or search on metacpan
#!/usr/bin/env -S perl -l
use FindBin qw/ $RealBin /;
# use lib "$RealBin/lib";
use v5.30;
use File::Basename qw/ basename dirname /;
use Data::Dumper;
use Getopt::Long;
use Term::ANSIColor qw( colored );
use My::Color qw/ :all /;
use My::Opts;
#---------------------------------------------------------
my ( $opts, @search ) = get_input();
my $all_cheats = get_all_cheats( $opts );
my $cheats = get_cheats( $all_cheats, $opts, \@search );
pretty_print( $cheats, $opts, \@search );
#---------------------------------------------------------
sub define_spec {
[
{
desc => "Show this help",
spec => "help|h",
},
{
desc => "Be case sensitive",
spec => "case_sensitive|i",
},
{
desc => "Use regex in search",
spec => "regex|r",
},
{
desc => "Show line numbers,",
spec => "show_line_numbers|n",
},
{
desc => "Do not color the output", # Description.
spec => "NoColor|C", # How to call it.
},
{
desc => "Type: cheats,notes",
spec => "type=s",
},
{
desc => "Colon separated path",
spec => "cheat_dirs=s",
},
{
desc => "Show debugging info",
spec => "debug|d:1",
},
]
}
sub get_input {
my $opts = My::Opts->new( define_spec() );
show_help( $opts ) if $opts->{help} or not @ARGV;
( $opts, @ARGV );
}
( run in 0.729 second using v1.01-cache-2.11-cpan-39bf76dae61 )