App-FzfUtils
view release on metacpan or search on metacpan
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:
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)
lib/App/FzfUtils.pm view on Meta::CPAN
[200, "OK", $args{tee} ? $result : ""];
}
$SPEC{fzf2clip_loop} = {
v => 1.1,
summary => "Like fzf2clip, but loop/repeat",
description => <<'MARKDOWN',
This is basically a shortcut for:
% fzf --bind 'enter:execute(clipadd {})' < input.txt
where <prog:clipadd> is a utility from <pm:App::ClipboardUtils>.
MARKDOWN
args => {
input => {
schema => 'str*',
cmdline_src => 'stdin_or_files',
pos => 0,
},
lib/App/FzfUtils.pm view on Meta::CPAN
},
};
sub fzf2clip_loop {
require IPC::Open2;
require Clipboard::Any;
my %args = @_;
my $input = $args{input};
my $pid = IPC::Open2::open2(my $out, my $in, q[fzf --bind 'enter:execute-silent(clipadd {})']);
for my $line (split /^/m, $input) {
print $in $line;
}
close $in;
close $out;
waitpid($pid, 0);
[200, "OK"];
}
$SPEC{cs_select} = {
v => 1.1,
summary => "Select entries from template to clipboard",
description => <<'MARKDOWN',
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:
lib/App/FzfUtils.pm view on Meta::CPAN
$dict->{$id} = $clip_content;
}
}
(my $tempfh, $jsonfile) = File::Temp::tempfile('XXXXXXXX', TMPDIR=>1, SUFFIX=>'.json');
log_trace "JSON file is at %s", $jsonfile;
print $tempfh JSON::PP::encode_json($dict);
close $tempfh;
} # PREPROCESS_TEMPLATE
my $pid = IPC::Open2::open2(my $out, my $in, qq[fzf --bind 'enter:execute-silent(cs-select-helper $jsonfile {})']);
for my $line (@lines) {
print $in $line;
}
close $in;
close $out;
waitpid($pid, 0);
[200, "OK"];
}
lib/App/FzfUtils.pm view on Meta::CPAN
=head2 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.
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:
lib/App/FzfUtils.pm view on Meta::CPAN
=head2 fzf2clip_loop
Usage:
fzf2clip_loop(%args) -> [$status_code, $reason, $payload, \%result_meta]
Like fzf2clip, but loopE<sol>repeat.
This is basically a shortcut for:
% fzf --bind 'enter:execute(clipadd {})' < input.txt
where L<clipadd> is a utility from L<App::ClipboardUtils>.
This function is not exported.
Arguments ('*' denotes required arguments):
=over 4
=item * B<input> => I<str>
script/cs-select view on Meta::CPAN
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:
script/fzf2clip-loop view on Meta::CPAN
B<fzf2clip-loop> B<L<--help|/"--help, -h, -?">> (or B<L<-h|/"--help, -h, -?">>, B<L<-?|/"--help, -h, -?">>)
B<fzf2clip-loop> B<L<--version|/"--version, -v">> (or B<L<-v|/"--version, -v">>)
B<fzf2clip-loop> [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 a shortcut for:
% fzf --bind 'enter:execute(clipadd {})' < input.txt
where L<clipadd> is a utility from L<App::ClipboardUtils>.
=head1 OPTIONS
C<*> marks required options.
=head2 Main options
=over
( run in 1.416 second using v1.01-cache-2.11-cpan-2398b32b56e )