view release on metacpan or search on metacpan
0.013 2025-10-16 Released-By: PERLANCAR; Urgency: low
- No functional changes.
- [doc] Add document:
App::ClipboardUtils::Manual::HowTo::ClipaddCookbook.
0.012 2025-10-15 Released-By: PERLANCAR; Urgency: medium
- [cli clipadd] Add option --fragments.
0.011 2025-06-15 Released-By: PERLANCAR; Urgency: medium
- [cli clipadd] Add option --command-line (-c).
0.010 2025-05-29 Released-By: PERLANCAR; Urgency: medium
- [ux] Add utility: tee-clipboard-content (cliptee, ct), which is a
Foo Bar, Co., Ltd.
foo-bar-co-ltd
BaZZ, Co., Ltd.
bazz-co-ltd
_
* content => *str*
(No description)
* fragments => *bool*
Only add text fragments inside content.
Cannot be used together with "--split-by" or "--command-line"
option.
Example content:
FAQS
====
Q: Will the Thingamagic explode under extreme pressure?
# BEGIN clipadd id=1
Q: What is the appropriate age to start using the Thingamagic?
A: It depends on whether your kid is smart (or stupid) enough.
# END clipadd id=1
Q: Another question?
A: Another half-assed answer.
Command:
% cat faq.txt | clipadd --fragments
Read Text::Fragment for more details on text fragments.
* split_by => *str_or_re*
Split content by specified string/regex, add the split content as
multiple clipboard entries.
Cannot be used together with "--fragments" or "--command-line"
option.
Note that if you supply a regex, you should not have any capture
groups in the regex.
* tee => *true*
Pass stdin to stdout.
Returns an enveloped result (an array).
lib/App/ClipboardUtils.pm view on Meta::CPAN
$SPEC{add_clipboard_content} = clone $Clipboard::Any::SPEC{add_clipboard_content};
# because we also have --command and do our own while(<>) { ... }
delete $SPEC{add_clipboard_content}{args}{content}{cmdline_src};
$SPEC{add_clipboard_content}{args}{split_by} = {
summary => 'Split content by specified string/regex, add the split content as multiple clipboard entries',
schema => ['str_or_re*'],
description => <<'MARKDOWN',
Cannot be used together with `--fragments` or `--command-line` option.
Note that if you supply a regex, you should not have any capture groups in the
regex.
MARKDOWN
cmdline_aliases => {s=>{}},
};
$SPEC{add_clipboard_content}{args}{fragments} = {
summary => 'Only add text fragments inside content',
schema => ['bool*'],
description => <<'MARKDOWN',
Cannot be used together with `--split-by` or `--command-line` option.
Example content:
FAQS
====
lib/App/ClipboardUtils.pm view on Meta::CPAN
# BEGIN clipadd id=1
Q: What is the appropriate age to start using the Thingamagic?
A: It depends on whether your kid is smart (or stupid) enough.
# END clipadd id=1
Q: Another question?
A: Another half-assed answer.
Command:
% cat faq.txt | clipadd --fragments
Read <pm:Text::Fragment> for more details on text fragments.
MARKDOWN
#cmdline_aliases => {f=>{}},
};
$SPEC{add_clipboard_content}{args}{tee} = {
summary => 'Pass stdin to stdout',
schema => ['true*'],
description => <<'MARKDOWN',
lib/App/ClipboardUtils.pm view on Meta::CPAN
foo-bar-co-ltd
BaZZ, Co., Ltd.
bazz-co-ltd
_
MARKDOWN
cmdline_aliases => {c=>{}},
};
$SPEC{add_clipboard_content}{args_rels}{"choose_one&"} = [
[qw/command_line split_by fragments/],
];
}
sub add_clipboard_content {
my %args = @_;
my $split_by = delete $args{split_by};
my $tee = delete $args{tee};
my $command_line = $args{command_line};
if (defined $command_line) {
lib/App/ClipboardUtils.pm view on Meta::CPAN
# do not add empty part to clipboard
if (length $part) {
$res = Clipboard::Any::add_clipboard_content(
%args, content => $part,
); # currently we use the last add_clipboard_content status
}
}
$res->[3]{'func.parts'} = @split_parts;
$res;
} elsif ($args{fragments}) {
require Text::Fragment;
my $lfres = Text::Fragment::list_fragments(text => $content, label => "clipadd");
return [500, "Can't list fragments in content: $lfres->[0] - $lfres->[1]"]
unless $lfres->[0] == 200;
my @parts = map { $_->{payload} } sort { $a->{id} <=> $b->{id} } @{ $lfres->[2] };
my $res = [204, "OK (no content)"];
for my $part (@parts) {
if ($tee) {
print $part;
}
# do not add empty part to clipboard
lib/App/ClipboardUtils.pm view on Meta::CPAN
Foo Bar, Co., Ltd.
foo-bar-co-ltd
BaZZ, Co., Ltd.
bazz-co-ltd
_
=item * B<content> => I<str>
(No description)
=item * B<fragments> => I<bool>
Only add text fragments inside content.
Cannot be used together with C<--split-by> or C<--command-line> option.
Example content:
FAQS
====
Q: Will the Thingamagic explode under extreme pressure?
A: No doubt.
lib/App/ClipboardUtils.pm view on Meta::CPAN
# BEGIN clipadd id=1
Q: What is the appropriate age to start using the Thingamagic?
A: It depends on whether your kid is smart (or stupid) enough.
# END clipadd id=1
Q: Another question?
A: Another half-assed answer.
Command:
% cat faq.txt | clipadd --fragments
Read L<Text::Fragment> for more details on text fragments.
=item * B<split_by> => I<str_or_re>
Split content by specified stringE<sol>regex, add the split content as multiple clipboard entries.
Cannot be used together with C<--fragments> or C<--command-line> option.
Note that if you supply a regex, you should not have any capture groups in the
regex.
=item * B<tee> => I<true>
Pass stdin to stdout.
lib/App/ClipboardUtils/Manual/HowTo/ClipaddCookbook.pod view on Meta::CPAN
Question 2
Answer 2
---
Question 3
Answer 3
then you can setup keyboard shortcuts like C<Ctrl-Alt-Up> and C<Ctrl-Alt-Down>
in B<Klipper> to quickly access those FAQ entries to provide quick answers in
chats.
=head2 Adding text fragments from a text file as clipboard contents
% clipadd --fragments < FILENAME
This is a variation from the previous recipe. Using fragments allows you to only
add certain entries and in custom order. Example content of text file:
FAQS
====
Question 1
# BEGIN clipadd id=2
Answer 1
# END clipadd id=2
script/add-clipboard-content view on Meta::CPAN
=head1 VERSION
This document describes version 0.014 of add-clipboard-content (from Perl distribution App-ClipboardUtils), released on 2025-10-16.
=head1 SYNOPSIS
B<add-clipboard-content> B<L<--help|/"--help, -h, -?">> (or B<L<-h|/"--help, -h, -?">>, B<L<-?|/"--help, -h, -?">>)
B<add-clipboard-content> B<L<--version|/"--version, -v">> (or B<L<-v|/"--version, -v">>)
B<add-clipboard-content> [B<L<--chomp-newline|/"--chomp-newline, -l">>|B<L<-l|/"--chomp-newline, -l">>|B<L<--no-chomp-newline|/"--chomp-newline, -l">>|B<L<--nochomp-newline|/"--chomp-newline, -l">>] [B<L<--clipboard-manager|/"--clipboard-manager=s, -...
See examples in the L</EXAMPLES> section.
=head1 DESCRIPTION
For C<xclip>: when adding content, the primary selection is set. The clipboard
content is unchanged.
script/add-clipboard-content view on Meta::CPAN
_
=item B<--content>=I<s>
(No description)
Can also be specified as the 1st command-line argument.
=item B<--fragments>
Only add text fragments inside content.
Cannot be used together with C<--split-by> or C<--command-line> option.
Example content:
FAQS
====
Q: Will the Thingamagic explode under extreme pressure?
A: No doubt.
script/add-clipboard-content view on Meta::CPAN
# BEGIN clipadd id=1
Q: What is the appropriate age to start using the Thingamagic?
A: It depends on whether your kid is smart (or stupid) enough.
# END clipadd id=1
Q: Another question?
A: Another half-assed answer.
Command:
% cat faq.txt | clipadd --fragments
Read L<Text::Fragment> for more details on text fragments.
=item B<--split-by>=I<s>, B<-s>
Split content by specified string/regex, add the split content as multiple clipboard entries.
Cannot be used together with C<--fragments> or C<--command-line> option.
Note that if you supply a regex, you should not have any capture groups in the
regex.
=item B<--tee>, B<-t>
Pass stdin to stdout.
=back
=head1 VERSION
This document describes version 0.014 of ca (from Perl distribution App-ClipboardUtils), released on 2025-10-16.
=head1 SYNOPSIS
B<ca> B<L<--help|/"--help, -h, -?">> (or B<L<-h|/"--help, -h, -?">>, B<L<-?|/"--help, -h, -?">>)
B<ca> B<L<--version|/"--version, -v">> (or B<L<-v|/"--version, -v">>)
B<ca> [B<L<--chomp-newline|/"--chomp-newline, -l">>|B<L<-l|/"--chomp-newline, -l">>|B<L<--no-chomp-newline|/"--chomp-newline, -l">>|B<L<--nochomp-newline|/"--chomp-newline, -l">>] [B<L<--clipboard-manager|/"--clipboard-manager=s, -m">>=I<str>|B<L<-m|...
See examples in the L</EXAMPLES> section.
=head1 DESCRIPTION
For C<xclip>: when adding content, the primary selection is set. The clipboard
content is unchanged.
_
=item B<--content>=I<s>
(No description)
Can also be specified as the 1st command-line argument.
=item B<--fragments>
Only add text fragments inside content.
Cannot be used together with C<--split-by> or C<--command-line> option.
Example content:
FAQS
====
Q: Will the Thingamagic explode under extreme pressure?
A: No doubt.
# BEGIN clipadd id=1
Q: What is the appropriate age to start using the Thingamagic?
A: It depends on whether your kid is smart (or stupid) enough.
# END clipadd id=1
Q: Another question?
A: Another half-assed answer.
Command:
% cat faq.txt | clipadd --fragments
Read L<Text::Fragment> for more details on text fragments.
=item B<--split-by>=I<s>, B<-s>
Split content by specified string/regex, add the split content as multiple clipboard entries.
Cannot be used together with C<--fragments> or C<--command-line> option.
Note that if you supply a regex, you should not have any capture groups in the
regex.
=item B<--tee>, B<-t>
Pass stdin to stdout.
=back
script/clipadd view on Meta::CPAN
=head1 VERSION
This document describes version 0.014 of clipadd (from Perl distribution App-ClipboardUtils), released on 2025-10-16.
=head1 SYNOPSIS
B<clipadd> B<L<--help|/"--help, -h, -?">> (or B<L<-h|/"--help, -h, -?">>, B<L<-?|/"--help, -h, -?">>)
B<clipadd> B<L<--version|/"--version, -v">> (or B<L<-v|/"--version, -v">>)
B<clipadd> [B<L<--chomp-newline|/"--chomp-newline, -l">>|B<L<-l|/"--chomp-newline, -l">>|B<L<--no-chomp-newline|/"--chomp-newline, -l">>|B<L<--nochomp-newline|/"--chomp-newline, -l">>] [B<L<--clipboard-manager|/"--clipboard-manager=s, -m">>=I<str>|B<...
See examples in the L</EXAMPLES> section.
=head1 DESCRIPTION
For C<xclip>: when adding content, the primary selection is set. The clipboard
content is unchanged.
script/clipadd view on Meta::CPAN
_
=item B<--content>=I<s>
(No description)
Can also be specified as the 1st command-line argument.
=item B<--fragments>
Only add text fragments inside content.
Cannot be used together with C<--split-by> or C<--command-line> option.
Example content:
FAQS
====
Q: Will the Thingamagic explode under extreme pressure?
A: No doubt.
script/clipadd view on Meta::CPAN
# BEGIN clipadd id=1
Q: What is the appropriate age to start using the Thingamagic?
A: It depends on whether your kid is smart (or stupid) enough.
# END clipadd id=1
Q: Another question?
A: Another half-assed answer.
Command:
% cat faq.txt | clipadd --fragments
Read L<Text::Fragment> for more details on text fragments.
=item B<--split-by>=I<s>, B<-s>
Split content by specified string/regex, add the split content as multiple clipboard entries.
Cannot be used together with C<--fragments> or C<--command-line> option.
Note that if you supply a regex, you should not have any capture groups in the
regex.
=item B<--tee>, B<-t>
Pass stdin to stdout.
=back