App-GrepUtils
view release on metacpan or search on metacpan
0.007 2026-07-16 Released-By: PERLANCAR; Urgency: medium
- Add utilities: grep-nonblank, grep-nonblank-clipboard.
0.006 2022-05-03 Released-By: PERLANCAR; Urgency: low
- No functional changes.
- Fix POD typo.
0.005 2021-11-14 Released-By: PERLANCAR; Urgency: low
Changes
LICENSE
MANIFEST
META.json
META.yml
Makefile.PL
README
dist.ini
lib/App/GrepUtils.pm
script/grep-nonblank
script/grep-nonblank-clipboard
script/grep-terms
t/00-compile.t
t/author-critic.t
t/author-pod-coverage.t
t/author-pod-syntax.t
weaver.ini
Makefile.PL view on Meta::CPAN
my %WriteMakefileArgs = (
"ABSTRACT" => "CLI utilities related to the Unix command 'grep'",
"AUTHOR" => "perlancar <perlancar\@cpan.org>",
"CONFIGURE_REQUIRES" => {
"ExtUtils::MakeMaker" => 0
},
"DISTNAME" => "App-GrepUtils",
"EXE_FILES" => [
"script/grep-nonblank",
"script/grep-nonblank-clipboard",
"script/grep-terms"
],
"LICENSE" => "perl",
"MIN_PERL_VERSION" => "5.010001",
"NAME" => "App::GrepUtils",
"PREREQ_PM" => {
"Clipboard::Any" => "0.011",
"Getopt::Long" => "2.50",
"IPC::System::Options" => "0.339",
"Log::ger" => "0.038",
VERSION
This document describes version 0.007 of App::GrepUtils (from Perl
distribution App-GrepUtils), released on 2026-07-16.
DESCRIPTION
This distribution includes the following CLI utilities related to the
Unix command "grep":
* grep-nonblank
* grep-nonblank-clipboard
* grep-terms
HOMEPAGE
Please visit the project's homepage at
<https://metacpan.org/release/App-GrepUtils>.
SOURCE
Source repository is at
<https://github.com/perlancar/perl-App-GrepUtils>.
lib/App/GrepUtils.pm view on Meta::CPAN
=head1 DESCRIPTION
This distribution includes the following CLI utilities related to the Unix
command C<grep>:
=over
=item * L<grep-nonblank>
=item * L<grep-nonblank-clipboard>
=item * L<grep-terms>
=back
=head1 HOMEPAGE
Please visit the project's homepage at L<https://metacpan.org/release/App-GrepUtils>.
=head1 SOURCE
script/grep-nonblank view on Meta::CPAN
=head1 SYNOPSIS
% grep-nonblank [OPTIONS | FILES]...
% grep-nonblank --help
% grep-nonblank --version|-V
Examples:
% grep-nonblank file.txt
% clipget | grep-nonblank | clipadd
% grep-nonblank-clipboard
=head1 DESCRIPTION
This is simply a shortcut for:
% perl -ne 'print if /\S/'
to save some typing. Especially see L<grep-nonblank-clipboard>.
=head1 EXIT CODES
0 on success.
255 on I/O error.
99 on command-line options error.
=head1 OPTIONS
script/grep-nonblank view on Meta::CPAN
=head1 HOMEPAGE
Please visit the project's homepage at L<https://metacpan.org/release/App-GrepUtils>.
=head1 SOURCE
Source repository is at L<https://github.com/perlancar/perl-App-GrepUtils>.
=head1 SEE ALSO
L<grep-nonblank-clipboard>
=head1 AUTHOR
perlancar <perlancar@cpan.org>
=head1 CONTRIBUTING
To contribute, you can send patches by email/via RT, or send pull requests on
GitHub.
script/grep-nonblank-clipboard view on Meta::CPAN
use Clipboard::Any ();
use Getopt::Long;
our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
our $DATE = '2026-07-16'; # DATE
our $DIST = 'App-GrepUtils'; # DIST
our $VERSION = '0.007'; # VERSION
our %Opts = (
clipboard_manager => undef,
tee => 0,
);
sub parse_cmdline {
Getopt::Long::Configure('auto_abbrev', 'pass_through');
my $res = GetOptions(
'version|V' => sub {
no warnings 'once';
say "grep-terms version ", ($main::VERSION // 'dev');
exit 0;
},
'help' => sub {
print <<USAGE;
Usage:
grep-nonblank-clipboard [OPTIONS | FILES]...
grep-nonblank-clipboard --help
grep-nonblank-clipboard --version|-V
Options:
--clipboard-manager=s
--tee
Examples:
% grep-nonblank-clipboard
For more details, see the manpage/documentation.
USAGE
exit 0;
},
'clipboard-manager=s' => \$Opts{clipboard_manager},
'tee' => \$Opts{tee},
);
exit 99 if !$res;
}
sub run {
my $res;
$res = Clipboard::Any::get_clipboard_content(clipboard_manager=>$Opts{clipboard_manager});
die "Can't get clipboard content: $res->[0] - $res->[1]\n"
unless $res->[0] == 200;
my $text = $res->[2];
my @res;
for (split /^/m, $text) {
push @res, $_ if /\S/;
}
$res = Clipboard::Any::add_clipboard_content(clipboard_manager=>$Opts{clipboard_manager}, content=>join("", @res));
die "Can't add clipboard content: $res->[0] - $res->[1]\n"
unless $res->[0] == 200;
print @res if $Opts{tee};
}
# MAIN
parse_cmdline();
run();
1;
# ABSTRACT: Remove blank lines in clipboard content
# PODNAME: grep-nonblank-clipboard
__END__
=pod
=encoding UTF-8
=head1 NAME
grep-nonblank-clipboard - Remove blank lines in clipboard content
=head1 VERSION
This document describes version 0.007 of grep-nonblank-clipboard (from Perl distribution App-GrepUtils), released on 2026-07-16.
=head1 SYNOPSIS
% grep-nonblank-clipboard [OPTIONS | FILES]...
% grep-nonblank --help
% grep-nonblank --version|-V
Examples:
% grep-nonblank-clipboard
=head1 DESCRIPTION
This is simply a shortcut for:
% clipget | grep-nonblank | clipadd
which is itself a shortcut for:
% clipget | perl -ne 'print if /\S/' | clipadd
script/grep-nonblank-clipboard view on Meta::CPAN
=head1 HOMEPAGE
Please visit the project's homepage at L<https://metacpan.org/release/App-GrepUtils>.
=head1 SOURCE
Source repository is at L<https://github.com/perlancar/perl-App-GrepUtils>.
=head1 SEE ALSO
L<grep-nonblank-clipboard>
=head1 AUTHOR
perlancar <perlancar@cpan.org>
=head1 CONTRIBUTING
To contribute, you can send patches by email/via RT, or send pull requests on
GitHub.
t/00-compile.t view on Meta::CPAN
use Test::More;
plan tests => 4 + ($ENV{AUTHOR_TESTING} ? 1 : 0);
my @module_files = (
'App/GrepUtils.pm'
);
my @scripts = (
'script/grep-nonblank',
'script/grep-nonblank-clipboard',
'script/grep-terms'
);
# no fake home requested
my @switches = (
-d 'blib' ? '-Mblib' : '-Ilib',
);
use File::Spec;
t/author-critic.t view on Meta::CPAN
}
use strict;
use warnings;
# this test was generated with Dist::Zilla::Plugin::Test::Perl::Critic::Subset 3.001.006
use Test::Perl::Critic (-profile => "") x!! -e "";
my $filenames = ['lib/App/GrepUtils.pm','script/grep-nonblank','script/grep-nonblank-clipboard','script/grep-terms'];
unless ($filenames && @$filenames) {
$filenames = -d "blib" ? ["blib"] : ["lib"];
}
all_critic_ok(@$filenames);
( run in 1.439 second using v1.01-cache-2.11-cpan-81fc1098f69 )