App-Greple-under

 view release on metacpan or  search on metacpan

lib/App/Greple/under.pm  view on Meta::CPAN

package App::Greple::under;
use 5.024;
use warnings;

our $VERSION = "1.00";

=encoding utf-8

=head1 NAME

App::Greple::under - greple under-line module

=head1 SYNOPSIS

    greple -Munder::line ...

    greple -Munder::mise ... | greple -Munder::place

=head1 DESCRIPTION

This module is intended to clarify highlighting points without ANSI
sequencing when highlighting by ANSI sequencing is not possible for
some reason.

The following command searches for a paragraph that contains all the
words specified.

    greple 'license agreements software freedom' LICENSE -p

=for html <p>
<img width="750" src="https://raw.githubusercontent.com/kaz-utashiro/greple-under/main/images/normal.png">
</p>

By default, the emphasis should be indicated by underlining it on the
next line.

    greple -Munder::line 'license agreements software freedom' LICENSE -p

Above command will produce output like this:

 ┌───────────────────────────────────────────────────────────────────────┐
 │   The license agreements of most software companies try to keep users │
 │       ▔▔▔▔▔▔▔ ▔▔▔▔▔▔▔▔▔▔         ▔▔▔▔▔▔▔▔                             │
 │ at the mercy of those companies.  By contrast, our General Public     │
 │ License is intended to guarantee your freedom to share and change free│
 │                                       ▔▔▔▔▔▔▔                         │
 │ software--to make sure the software is free for all its users.  The   │
 │ ▔▔▔▔▔▔▔▔                   ▔▔▔▔▔▔▔▔                                   │
 │ General Public License applies to the Free Software Foundation's      │
 │ software and to any other program whose authors commit to using it.   │
 │ ▔▔▔▔▔▔▔▔                                                              │
 │ You can use it for your programs, too.                                │
 └───────────────────────────────────────────────────────────────────────┘

=for html <p>
<img width="750" src="https://raw.githubusercontent.com/kaz-utashiro/greple-under/main/images/under-line.png">
</p>

If you want to process the search results before underlining them,
process them in the C<-Munder::mise> module and then pass them through
the C<-Munder::place> module.

    greple -Munder::mise ... | ... | greple -Munder::place

=for html <p>
<img width="750" src="https://raw.githubusercontent.com/kaz-utashiro/greple-under/main/images/mise-place.png">
</p>

=head1 MODULE OPTION

=head2 B<--config>

Set config parameters.

    greple -Munder::line --config type=eighth -- ...

Configuable parameters:

=over 4

=item C<type>

Set under-line type.

=item C<sequence>

Set under-line sequence.  The given string is broken down into single
character sequences.

=back

=head2 B<--show-colormap>

Print custom colormaps separated by whitespace characters.  You can
read them into an array by L<bash(1)> like this:

    read -a MAP < <(greple -Munder::place --show-colormap --)

=head1 SEE ALSO

L<App::Greple>

=head1 AUTHOR

Kazumasa Utashiro

=head1 LICENSE

Copyright ©︎ 2024-2025 Kazumasa Utashiro.

This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.

=cut

use Exporter 'import';
our @EXPORT_OK = qw(%config &config &finalize);
our %EXPORT_TAGS = (all => \@EXPORT_OK);

use App::Greple::Common qw(@color_list);
use Term::ANSIColor::Concise qw(ansi_code);
use Text::ANSI::Fold;
use Text::ANSI::Fold::Util qw(ansi_width);
use Hash::Util qw(lock_keys);
use Data::Dumper;



( run in 0.465 second using v1.01-cache-2.11-cpan-df04353d9ac )