App-FzfUtils

 view release on metacpan or  search on metacpan

script/cs-select  view on Meta::CPAN

#!perl

# Note: This script is a CLI for Riap function /App/FzfUtils/cs_select
# and generated automatically using Perinci::CmdLine::Gen version 0.502

use 5.010001;
use strict;
use warnings;
use Log::ger;

use Perinci::CmdLine::Any;

our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
our $DATE = '2026-04-09'; # DATE
our $DIST = 'App-FzfUtils'; # DIST
our $VERSION = '0.003'; # VERSION

my $cmdline = Perinci::CmdLine::Any->new(
    url => "/App/FzfUtils/cs_select",
    program_name => "cs-select",
    log => 1,
    read_config => 0,
    read_env => 0,
);

$cmdline->run;

# ABSTRACT: Select entries from template to clipboard
# PODNAME: cs-select

__END__

=pod

=encoding UTF-8

=head1 NAME

cs-select - Select entries from template to clipboard

=head1 VERSION

This document describes version 0.003 of cs-select (from Perl distribution App-FzfUtils), released on 2026-04-09.

=head1 SYNOPSIS

B<cs-select> B<L<--help|/"--help, -h, -?">> (or B<L<-h|/"--help, -h, -?">>, B<L<-?|/"--help, -h, -?">>)

B<cs-select> B<L<--version|/"--version, -v">> (or B<L<-v|/"--version, -v">>)

B<cs-select> [B<L<--debug|/"--debug">>|B<L<--log-level|/"--log-level=s">>=I<level>|B<L<--quiet|/"--quiet">>|B<L<--trace|/"--trace">>|B<L<--verbose|/"--verbose">>] [B<L<--format|/"--format=s">>=I<name>|B<L<--json|/"--json">>] [B<L<--(no)naked-res|/"--...

=head1 DESCRIPTION

This is basically similar to:

 % fzf --bind 'enter:execute(clipadd {})' < template.txt

except that it does some pre-processing to let each template entry be a
multiple-line text, and later do post-processing so the original entry is added
to the clipboard.

B<Template format>

Template is an Org file with a particular format, where each entry is put under
a level-2 heading. The level-1 heading can be used for grouping/categorizing.
For example:

 * Product > P1
 ** Does P1 need to be replaced every 5 years?  :replacement:clipadd_1:
 Yes, ideally every 3-5 years.
 ** How to maintain P1 so it is in a good condition and can last longer?
 Wash after every use, then dry.
 Keep it clean.
 And of course replace after 3-5 years.
 * Product > P2
 ** Entry 1  :clipadd_2:
 ...
 ** Entry 2
 ...
 * General > Support
 ** Entry 3
 ...
 ** Entry 4
 ...

Before feeding to C<fzf>, this utility will convert each entry into a single
line:

 [id=1][title=Does P1 need to be replaced every 5 years?]Yes, ideally every 3-5 years.[category=Product > P1][tag=replacement][tag=clipadd_1]
 [id=2][title=How to maintain P1 so it is in a good condition and can last longer?]Wash after every use, then dry. Keep it clean. And of course replace after 3-5 years.[category=Product > P1]
 [id=3][title=Entry 1]...[tag=clipadd_2][category=Product > P2]
 [id=4][title=Entry 2]...[category=Product > P2]
 [id=5][title=Entry 3]...[category=General > Support]
 [id=6][title=Entry 4]...[category=General > Support]

after selection, another script (L<cs-select-helper>) will turn back the
single-line entry into the original.

B<Tags>

Some Org tags are used to customize how the entry is displayed or copied to
clipboard.

B<no_copy_title>. Do not copy the title to clipboard.

=head1 OPTIONS

C<*> marks required options.

=head2 Main options

=over

=item B<--template>=I<s>

(No description)


Can also be specified as the 1st command-line argument.

=item B<--wrap>=I<s>, B<-w>

(No description)


=back

=head2 Logging options

=over

=item B<--debug>

Shortcut for --log-level=debug.

=item B<--log-level>=I<s>

Set log level.

By default, these log levels are available (in order of increasing level of
importance, from least important to most): C<trace>, C<debug>, C<info>,
C<warn>/C<warning>, C<error>, C<fatal>. By default, the level is usually set to
C<warn>, which means that log statements with level C<info> and less important
levels will not be shown. To increase verbosity, choose C<info>, C<debug>, or
C<trace>.

For more details on log level and logging, as well as how new logging levels can
be defined or existing ones modified, see L<Log::ger>.


=item B<--quiet>

Shortcut for --log-level=error.

=item B<--trace>

Shortcut for --log-level=trace.

=item B<--verbose>

Shortcut for --log-level=info.

=back



( run in 0.566 second using v1.01-cache-2.11-cpan-84e82930d8c )