NAME
App::FzfUtils - Utilities related to fzf
VERSION
This document describes version 0.003 of App::FzfUtils (from Perl distribution App-FzfUtils), released on 2026-04-09.
DESCRIPTION
This distribution includes the following CLI utilities related to fzf:
FUNCTIONS
cs_select
Usage:
cs_select(%args) -> [$status_code, $reason, $payload, \%result_meta]
Select entries from template to clipboard.
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.
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 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 (cs-select-helper) will turn back the single-line entry into the original.
Tags
Some Org tags are used to customize how the entry is displayed or copied to clipboard.
no_copy_title. Do not copy the title to clipboard.
This function is not exported.
Arguments ('*' denotes required arguments):
template => str
(No description)
wrap => posint
(No description)
Returns an enveloped result (an array).
First element ($status_code) is an integer containing HTTP-like status code (200 means OK, 4xx caller error, 5xx function error). Second element ($reason) is a string containing error message, or something like "OK" if status is 200. Third element ($payload) is the actual result, but usually not present when enveloped result is an error response ($status_code is not 2xx). Fourth element (%result_meta) is called result metadata and is optional, a hash that contains extra information, much like how HTTP response headers provide additional metadata.
Return value: (any)
fzf2clip
Usage:
fzf2clip(%args) -> [$status_code, $reason, $payload, \%result_meta]
Select using fzf, then add selection to clipboard.
This is basically a shortcut for:
% fzf < input.txt | clipadd
where clipadd is a utility from App::ClipboardUtils.
This function is not exported.
Arguments ('*' denotes required arguments):
input => str
(No description)
tee => bool
In addition to adding to clipboard, also print to STDOUT.
Returns an enveloped result (an array).
First element ($status_code) is an integer containing HTTP-like status code (200 means OK, 4xx caller error, 5xx function error). Second element ($reason) is a string containing error message, or something like "OK" if status is 200. Third element ($payload) is the actual result, but usually not present when enveloped result is an error response ($status_code is not 2xx). Fourth element (%result_meta) is called result metadata and is optional, a hash that contains extra information, much like how HTTP response headers provide additional metadata.
Return value: (any)
fzf2clip_loop
Usage:
fzf2clip_loop(%args) -> [$status_code, $reason, $payload, \%result_meta]
Like fzf2clip, but loop/repeat.
This is basically a shortcut for:
% fzf --bind 'enter:execute(clipadd {})' < input.txt
where clipadd is a utility from App::ClipboardUtils.
This function is not exported.
Arguments ('*' denotes required arguments):
input => str
(No description)
Returns an enveloped result (an array).
First element ($status_code) is an integer containing HTTP-like status code (200 means OK, 4xx caller error, 5xx function error). Second element ($reason) is a string containing error message, or something like "OK" if status is 200. Third element ($payload) is the actual result, but usually not present when enveloped result is an error response ($status_code is not 2xx). Fourth element (%result_meta) is called result metadata and is optional, a hash that contains extra information, much like how HTTP response headers provide additional metadata.
Return value: (any)
HOMEPAGE
Please visit the project's homepage at https://metacpan.org/release/App-FzfUtils.
SOURCE
Source repository is at https://github.com/perlancar/perl-App-FzfUtils.
AUTHOR
perlancar <perlancar@cpan.org>
CONTRIBUTING
To contribute, you can send patches by email/via RT, or send pull requests on GitHub.
Most of the time, you don't need to build the distribution yourself. You can simply modify the code, then test via:
% prove -l
If you want to build the distribution (e.g. to try to install it locally on your system), you can install Dist::Zilla, Dist::Zilla::PluginBundle::Author::PERLANCAR, Pod::Weaver::PluginBundle::Author::PERLANCAR, and sometimes one or two other Dist::Zilla- and/or Pod::Weaver plugins. Any additional steps required beyond that are considered a bug and can be reported to me.
COPYRIGHT AND LICENSE
This software is copyright (c) 2026 by perlancar <perlancar@cpan.org>.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
BUGS
Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=App-FzfUtils
When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.