App-JsonLogUtils
view release on metacpan or search on metacpan
GetOptions(
'help' => \$help,
'path=s' => \$path,
) or pod2usage(2);
do{ pod2usage 1; exit 0; } if $help;
#-------------------------------------------------------------------------------
# Set up global environment
#-------------------------------------------------------------------------------
my $default_prompt = green . '$ ' . default ;
my $prompt = $default_prompt;
my $term = Term::ReadLine->new('jshell');
my (@fields, %match, %skip);
#-------------------------------------------------------------------------------
# Utilities
#-------------------------------------------------------------------------------
sub out { print { $term->OUT } @_, default, "\n" }
sub set_prompt { $prompt = shift || $default_prompt }
#-------------------------------------------------------------------------------
# Iterators
#-------------------------------------------------------------------------------
sub filtered {
my $json = shift;
return igrep{
my ($obj, $line) = @$_;
sub cmd_h { goto \&cmd_help }
sub cmd_i { goto \&cmd_info }
sub cmd_q { goto \&cmd_quit }
sub cmd_r { goto \&cmd_reset }
sub cmd_t { goto \&cmd_tail }
sub cmd_v { goto \&cmd_grepv }
#-------------------------------------------------------------------------------
# Main loop
#-------------------------------------------------------------------------------
while (defined(my $input = $term->readline($prompt))) {
next unless $input;
chomp $input;
if ($input eq '!!') {
$input = $term->previous_history;
out $input;
}
my ($cmd, @args) = split /\s+/, $input;
( run in 0.916 second using v1.01-cache-2.11-cpan-6aa56a78535 )