App-ClipboardUtils

 view release on metacpan or  search on metacpan

script/ca  view on Meta::CPAN

#!perl

# Note: This script is a CLI for Riap function /App/ClipboardUtils/add_clipboard_content
# 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 = '2025-10-16'; # DATE
our $DIST = 'App-ClipboardUtils'; # DIST
our $VERSION = '0.014'; # VERSION

my $cmdline = Perinci::CmdLine::Any->new(
    url => "/App/ClipboardUtils/add_clipboard_content",
    program_name => "ca",
    log => 1,
    read_config => 0,
    read_env => 0,
);

$cmdline->run;

# ABSTRACT: Even shorter alias for add-clipboard-content and clipadd
# PODNAME: ca

__END__

=pod

=encoding UTF-8

=head1 NAME

ca - Even shorter alias for add-clipboard-content and clipadd

=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.

=head1 OPTIONS

C<*> marks required options.

=head2 Main options

=over

=item B<--chomp-newline>, B<-l>

Remove trailing newlines before adding item to clipboard.

=item B<--clipboard-manager>=I<s>, B<-m>

Explicitly set clipboard manager to use.

Valid values:

 ["klipper","parcellite","clipit","xclip"]

The default, when left undef, is to detect what clipboard manager is running.


=item B<--command-line>=I<s>, B<-c>

For every line of input in *stdin*, execute a command, feed it the input line, and add the output to clipboard.

Note that when you use this option, the C<--content> argument is ignored. Input
is taken from stdin. With C<--tee>, each output will be printed to stdout. After
eof, the utility will return empty result.

An example for using this option (L<safer> is a utility from L<App::safer>):

 % clipadd -c safer --tee
 Foo Bar, Co., Ltd.
 foo-bar-co-ltd
 BaZZ, Co., Ltd.
 bazz-co-ltd
 _


=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=2
 Q: How much pressure should I apply to the Thingamagic initially?
 A: Not that much, really. It will pressurize itself eventually.
 # END clipadd id=2
 
 # 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

=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

=head2 Output options

=over

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

Choose output format, e.g. json, text.

Default value:

 undef



( run in 2.215 seconds using v1.01-cache-2.11-cpan-b16cb0d3907 )