App-TextWrapUtils

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

0.007   2023-04-13  Released-By: PERLANCAR; Urgency: medium

        - [clis textwrap-clipboard, nowrap-clipboard] Add option --tee.


0.006   2023-03-07  Released-By: PERLANCAR; Urgency: medium

        - Apply suggestion from UTASHIRO for Text::ANSI::Fold backend (GH#1).

        - [ux] Add -b as short alias for --backend.


0.005   2022-12-14  Released-By: PERLANCAR; Urgency: medium

        - [ux] Add aliases commands: nowrap -> textunwrap, nowrap-clipboard
          -> textunwrap-clipboard.


0.004   2022-12-13  Released-By: PERLANCAR; Urgency: medium

        - Add utilities: textwrap-clipboard, textunwrap-clipboard.


0.003   2022-12-13  Released-By: PERLANCAR; Urgency: medium

        - Add utility: textunwrap.

        - Tweak Abstract for textwrap.


0.002   2022-12-13  Released-By: PERLANCAR; Urgency: medium; Backward-Incompatible: yes

MANIFEST  view on Meta::CPAN

Changes
LICENSE
MANIFEST
META.json
META.yml
Makefile.PL
README
dist.ini
lib/App/TextWrapUtils.pm
script/nowrap
script/nowrap-clipboard
script/textunwrap
script/textunwrap-clipboard
script/textwrap
script/textwrap-clipboard
t/00-compile.t
t/author-critic.t
t/author-pod-coverage.t
t/author-pod-syntax.t
t/release-rinci.t
weaver.ini

META.json  view on Meta::CPAN

         "version" : "5.034000"
      },
      "plugins" : [
         {
            "class" : "Dist::Zilla::Plugin::GenPericmdScript",
            "name" : "GenPericmdScript nowrap",
            "version" : "0.424"
         },
         {
            "class" : "Dist::Zilla::Plugin::GenPericmdScript",
            "name" : "GenPericmdScript textunwrap-clipboard",
            "version" : "0.424"
         },
         {
            "class" : "Dist::Zilla::Plugin::GenPericmdScript",
            "name" : "GenPericmdScript textunwrap",
            "version" : "0.424"
         },
         {
            "class" : "Dist::Zilla::Plugin::GenPericmdScript",
            "name" : "GenPericmdScript nowrap-clipboard",
            "version" : "0.424"
         },
         {
            "class" : "Dist::Zilla::Plugin::GenPericmdScript",
            "name" : "GenPericmdScript textwrap",
            "version" : "0.424"
         },
         {
            "class" : "Dist::Zilla::Plugin::GenPericmdScript",
            "name" : "GenPericmdScript textwrap-clipboard",
            "version" : "0.424"
         },
         {
            "class" : "Dist::Zilla::Plugin::InsertExecsList",
            "name" : "InsertExecsList",
            "version" : "0.032"
         },
         {
            "class" : "Dist::Zilla::Plugin::PERLANCAR::CheckPendingRelease",
            "name" : "@Author::PERLANCAR/PERLANCAR::CheckPendingRelease",

META.yml  view on Meta::CPAN

x_Dist_Zilla:
  perl:
    version: '5.034000'
  plugins:
    -
      class: Dist::Zilla::Plugin::GenPericmdScript
      name: 'GenPericmdScript nowrap'
      version: '0.424'
    -
      class: Dist::Zilla::Plugin::GenPericmdScript
      name: 'GenPericmdScript textunwrap-clipboard'
      version: '0.424'
    -
      class: Dist::Zilla::Plugin::GenPericmdScript
      name: 'GenPericmdScript textunwrap'
      version: '0.424'
    -
      class: Dist::Zilla::Plugin::GenPericmdScript
      name: 'GenPericmdScript nowrap-clipboard'
      version: '0.424'
    -
      class: Dist::Zilla::Plugin::GenPericmdScript
      name: 'GenPericmdScript textwrap'
      version: '0.424'
    -
      class: Dist::Zilla::Plugin::GenPericmdScript
      name: 'GenPericmdScript textwrap-clipboard'
      version: '0.424'
    -
      class: Dist::Zilla::Plugin::InsertExecsList
      name: InsertExecsList
      version: '0.032'
    -
      class: Dist::Zilla::Plugin::PERLANCAR::CheckPendingRelease
      name: '@Author::PERLANCAR/PERLANCAR::CheckPendingRelease'
      version: '0.001'
    -

Makefile.PL  view on Meta::CPAN


my %WriteMakefileArgs = (
  "ABSTRACT" => "Utilities related to text wrapping",
  "AUTHOR" => "perlancar <perlancar\@cpan.org>",
  "CONFIGURE_REQUIRES" => {
    "ExtUtils::MakeMaker" => 0
  },
  "DISTNAME" => "App-TextWrapUtils",
  "EXE_FILES" => [
    "script/nowrap",
    "script/nowrap-clipboard",
    "script/textunwrap",
    "script/textunwrap-clipboard",
    "script/textwrap",
    "script/textwrap-clipboard"
  ],
  "LICENSE" => "perl",
  "MIN_PERL_VERSION" => "5.010001",
  "NAME" => "App::TextWrapUtils",
  "PREREQ_PM" => {
    "Clipboard::Any" => "0.009",
    "Data::Sah::Compiler::perl::TH::bool" => "0.914",
    "Data::Sah::Compiler::perl::TH::int" => "0.914",
    "Data::Sah::Compiler::perl::TH::str" => "0.914",
    "Data::Sah::Filter::perl::Path::expand_tilde_when_on_unix" => 0,

README  view on Meta::CPAN


VERSION
    This document describes version 0.007 of App::TextWrapUtils (from Perl
    distribution App-TextWrapUtils), released on 2023-04-13.

DESCRIPTION
    This distributions provides the following command-line utilities:

    *   nowrap

    *   nowrap-clipboard

    *   textunwrap

    *   textunwrap-clipboard

    *   textwrap

    *   textwrap-clipboard

    Keywords: fold.

FUNCTIONS
  textunwrap
    Usage:

     textunwrap(%args) -> [$status_code, $reason, $payload, \%result_meta]

    Unwrap (unfold) multiline paragraphs to single-line ones.

README  view on Meta::CPAN

    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)

  textunwrap_clipboard
    Usage:

     textunwrap_clipboard(%args) -> [$status_code, $reason, $payload, \%result_meta]

    Unwrap (unfold) multiline paragraphs in clipboard to single-line ones.

    This is shortcut for something like:

     % clipget | textunwrap ... | clipadd

    where clipget and clipadd are utilities to get text from clipboard and
    set text of clipboard, respectively.

    This function is not exported.

    Arguments ('*' denotes required arguments):

    *   backend => *perl::modname* (default: "Text::ANSI::Util")

        (No description)

    *   clipboard_manager => *str*

        Explicitly set clipboard manager to use.

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

    *   tee => *bool*

        If set to true, will also print result 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

README  view on Meta::CPAN

    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)

  textwrap_clipboard
    Usage:

     textwrap_clipboard(%args) -> [$status_code, $reason, $payload, \%result_meta]

    Wrap (fold) paragraphs in text in clipboard using one of several Perl
    modules.

    This is shortcut for something like:

     % clipget | textwrap ... | clipadd

    where clipget and clipadd are utilities to get text from clipboard and
    set text of clipboard, respectively.

    This function is not exported.

    Arguments ('*' denotes required arguments):

    *   backend => *perl::modname* (default: "Text::ANSI::Util")

        (No description)

    *   clipboard_manager => *str*

        Explicitly set clipboard manager to use.

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

    *   tee => *bool*

        If set to true, will also print result to STDOUT.

    *   width => *posint* (default: 80)

        (No description)

dist.ini  view on Meta::CPAN

name=App-TextWrapUtils

[GenPericmdScript / GenPericmdScript nowrap]
name=nowrap
summary=Alias for textunwrap
url=/App/TextWrapUtils/textunwrap
enable_log=1
read_config=0
read_env=0

[GenPericmdScript / GenPericmdScript textunwrap-clipboard]
name=nowrap-clipboard
summary=Alias for textunwrap-clipboard
url=/App/TextWrapUtils/textunwrap_clipboard
enable_log=1
read_config=0
read_env=0

[GenPericmdScript / GenPericmdScript textunwrap]
url=/App/TextWrapUtils/textunwrap
enable_log=1
read_config=0
read_env=0

[GenPericmdScript / GenPericmdScript nowrap-clipboard]
url=/App/TextWrapUtils/textunwrap_clipboard
enable_log=1
read_config=0
read_env=0

[GenPericmdScript / GenPericmdScript textwrap]
url=/App/TextWrapUtils/textwrap
enable_log=1
read_config=0
read_env=0

[GenPericmdScript / GenPericmdScript textwrap-clipboard]
url=/App/TextWrapUtils/textwrap_clipboard
enable_log=1
read_config=0
read_env=0

[InsertExecsList]

[@Author::PERLANCAR]
:version=0.606

[Prereqs]

lib/App/TextWrapUtils.pm  view on Meta::CPAN

            $para_text = Text::Wrap::wrap('', '', $para_text);
        } else {
            return [400, "Unknown backend '$backend'"];
        }

        $res .= $para_text . ($blank_lines // "");
    }
    [200, "OK", $res];
}

$SPEC{textwrap_clipboard} = {
    v => 1.1,
    summary => 'Wrap (fold) paragraphs in text in clipboard using one of several Perl modules',
    description => <<'_',

This is shortcut for something like:

    % clipget | textwrap ... | clipadd

where <prog:clipget> and <prog:clipadd> are utilities to get text from clipboard
and set text of clipboard, respectively.

_
    args => {
        %argspecopt_backend,
        %argspecopt_width,
        %Clipboard::Any::argspecopt_clipboard_manager,
        %argspecopt_tee,
    },
};
sub textwrap_clipboard {
    my %args = @_;
    my $cm = delete $args{clipboard_manager};

    my $res;
    $res = Clipboard::Any::get_clipboard_content(clipboard_manager=>$cm);
    return [500, "Can't get clipboard content: $res->[0] - $res->[1]"]
        unless $res->[0] == 200;
    my $text = $res->[2];

    $res = textwrap(%args, _text => $text);
    return $res unless $res->[0] == 200;
    my $wrapped_text = $res->[2];

    $res = Clipboard::Any::add_clipboard_content(clipboard_manager=>$cm, content=>$wrapped_text);
    return [500, "Can't add clipboard content: $res->[0] - $res->[1]"]
        unless $res->[0] == 200;

    print $wrapped_text if $args{tee};
    [200, "OK"];
}

$SPEC{textunwrap} = {
    v => 1.1,
    summary => 'Unwrap (unfold) multiline paragraphs to single-line ones',
    description => <<'_',

lib/App/TextWrapUtils.pm  view on Meta::CPAN

    args => {
        %argspecopt0_filename,
        %argspecopt_backend,
    },
};
sub textunwrap {
    my %args = @_;
    textwrap(%args, width=>999_999);
}

$SPEC{textunwrap_clipboard} = {
    v => 1.1,
    summary => 'Unwrap (unfold) multiline paragraphs in clipboard to single-line ones',
    description => <<'_',

This is shortcut for something like:

    % clipget | textunwrap ... | clipadd

where <prog:clipget> and <prog:clipadd> are utilities to get text from clipboard
and set text of clipboard, respectively.

_
    args => {
        %argspecopt_backend,
        %Clipboard::Any::argspecopt_clipboard_manager,
        %argspecopt_tee,
    },
};
sub textunwrap_clipboard {
    my %args = @_;
    my $cm = delete $args{clipboard_manager};

    my $res;
    $res = Clipboard::Any::get_clipboard_content(clipboard_manager=>$cm);
    return [500, "Can't get clipboard content: $res->[0] - $res->[1]"]
        unless $res->[0] == 200;
    my $text = $res->[2];

    $res = textunwrap(%args, _text => $text);
    return $res unless $res->[0] == 200;
    my $unwrapped_text = $res->[2];

    $res = Clipboard::Any::add_clipboard_content(clipboard_manager=>$cm, content=>$unwrapped_text);
    return [500, "Can't add clipboard content: $res->[0] - $res->[1]"]
        unless $res->[0] == 200;

    print $unwrapped_text if $args{tee};
    [200, "OK"];
}

1;
# ABSTRACT: Utilities related to text wrapping

__END__

lib/App/TextWrapUtils.pm  view on Meta::CPAN

This document describes version 0.007 of App::TextWrapUtils (from Perl distribution App-TextWrapUtils), released on 2023-04-13.

=head1 DESCRIPTION

This distributions provides the following command-line utilities:

=over

=item * L<nowrap>

=item * L<nowrap-clipboard>

=item * L<textunwrap>

=item * L<textunwrap-clipboard>

=item * L<textwrap>

=item * L<textwrap-clipboard>

=back

Keywords: fold.

=head1 FUNCTIONS


=head2 textunwrap

lib/App/TextWrapUtils.pm  view on Meta::CPAN

(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)



=head2 textunwrap_clipboard

Usage:

 textunwrap_clipboard(%args) -> [$status_code, $reason, $payload, \%result_meta]

Unwrap (unfold) multiline paragraphs in clipboard to single-line ones.

This is shortcut for something like:

 % clipget | textunwrap ... | clipadd

where L<clipget> and L<clipadd> are utilities to get text from clipboard
and set text of clipboard, respectively.

This function is not exported.

Arguments ('*' denotes required arguments):

=over 4

=item * B<backend> => I<perl::modname> (default: "Text::ANSI::Util")

(No description)

=item * B<clipboard_manager> => I<str>

Explicitly set clipboard manager to use.

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

=item * B<tee> => I<bool>

If set to true, will also print result to STDOUT.


=back

Returns an enveloped result (an array).

lib/App/TextWrapUtils.pm  view on Meta::CPAN

(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)



=head2 textwrap_clipboard

Usage:

 textwrap_clipboard(%args) -> [$status_code, $reason, $payload, \%result_meta]

Wrap (fold) paragraphs in text in clipboard using one of several Perl modules.

This is shortcut for something like:

 % clipget | textwrap ... | clipadd

where L<clipget> and L<clipadd> are utilities to get text from clipboard
and set text of clipboard, respectively.

This function is not exported.

Arguments ('*' denotes required arguments):

=over 4

=item * B<backend> => I<perl::modname> (default: "Text::ANSI::Util")

(No description)

=item * B<clipboard_manager> => I<str>

Explicitly set clipboard manager to use.

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

=item * B<tee> => I<bool>

If set to true, will also print result to STDOUT.

=item * B<width> => I<posint> (default: 80)

(No description)


script/nowrap-clipboard  view on Meta::CPAN

#!perl

# Note: This script is a CLI for Riap function /App/TextWrapUtils/textunwrap_clipboard
# 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 = '2023-04-13'; # DATE
our $DIST = 'App-TextWrapUtils'; # DIST
our $VERSION = '0.007'; # VERSION

my $cmdline = Perinci::CmdLine::Any->new(
    url => "/App/TextWrapUtils/textunwrap_clipboard",
    program_name => "nowrap-clipboard",
    log => 1,
    read_config => 0,
    read_env => 0,
);

$cmdline->run;

# ABSTRACT: Alias for textunwrap-clipboard
# PODNAME: nowrap-clipboard

__END__

=pod

=encoding UTF-8

=head1 NAME

nowrap-clipboard - Alias for textunwrap-clipboard

=head1 VERSION

This document describes version 0.007 of nowrap-clipboard (from Perl distribution App-TextWrapUtils), released on 2023-04-13.

=head1 SYNOPSIS

B<nowrap-clipboard> B<L<--help|/"--help, -h, -?">> (or B<L<-h|/"--help, -h, -?">>, B<L<-?|/"--help, -h, -?">>)

B<nowrap-clipboard> B<L<--version|/"--version, -v">> (or B<L<-v|/"--version, -v">>)

B<nowrap-clipboard> [B<L<--backend|/"--backend=s, -b">>=I<L<perl::modname|Sah::Schema::perl::modname>>|B<L<-b|/"--backend=s, -b">>=I<L<perl::modname|Sah::Schema::perl::modname>>] [B<L<--clipboard-manager|/"--clipboard-manager=s, -m">>=I<str>|B<L<-m|/...

=head1 DESCRIPTION

This is shortcut for something like:

 % clipget | textunwrap ... | clipadd

where L<clipget> and L<clipadd> are utilities to get text from clipboard
and set text of clipboard, respectively.

=head1 OPTIONS

C<*> marks required options.

=head2 Main options

=over

=item B<--backend>=I<s>, B<-b>

Default value:

 "Text::ANSI::Util"

Valid values:

 ["Text::ANSI::Fold","Text::ANSI::Util","Text::ANSI::WideUtil","Text::Fold","Text::LineFold","Text::WideChar::Util","Text::Wrap"]

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

If set to true, will also print result to STDOUT.

=back

=head2 Logging options

script/nowrap-clipboard  view on Meta::CPAN


=head1 COMPLETION

This script has shell tab completion capability with support for several
shells.

=head2 bash

To activate bash completion for this script, put:

 complete -C nowrap-clipboard nowrap-clipboard

in your bash startup (e.g. F<~/.bashrc>). Your next shell session will then
recognize tab completion for the command. Or, you can also directly execute the
line above in your shell to activate immediately.

It is recommended, however, that you install modules using L<cpanm-shcompgen>
which can activate shell completion for scripts immediately.

=head2 tcsh

To activate tcsh completion for this script, put:

 complete nowrap-clipboard 'p/*/`nowrap-clipboard`/'

in your tcsh startup (e.g. F<~/.tcshrc>). Your next shell session will then
recognize tab completion for the command. Or, you can also directly execute the
line above in your shell to activate immediately.

It is also recommended to install L<shcompgen> (see above).

=head2 other shells

For fish and zsh, install L<shcompgen> as described above.

script/textunwrap-clipboard  view on Meta::CPAN

#!perl

# Note: This script is a CLI for Riap function /App/TextWrapUtils/textunwrap_clipboard
# 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 = '2023-04-13'; # DATE
our $DIST = 'App-TextWrapUtils'; # DIST
our $VERSION = '0.007'; # VERSION

my $cmdline = Perinci::CmdLine::Any->new(
    url => "/App/TextWrapUtils/textunwrap_clipboard",
    program_name => "textunwrap-clipboard",
    log => 1,
    read_config => 0,
    read_env => 0,
);

$cmdline->run;

# ABSTRACT: Unwrap (unfold) multiline paragraphs in clipboard to single-line ones
# PODNAME: textunwrap-clipboard

__END__

=pod

=encoding UTF-8

=head1 NAME

textunwrap-clipboard - Unwrap (unfold) multiline paragraphs in clipboard to single-line ones

=head1 VERSION

This document describes version 0.007 of textunwrap-clipboard (from Perl distribution App-TextWrapUtils), released on 2023-04-13.

=head1 SYNOPSIS

B<textunwrap-clipboard> B<L<--help|/"--help, -h, -?">> (or B<L<-h|/"--help, -h, -?">>, B<L<-?|/"--help, -h, -?">>)

B<textunwrap-clipboard> B<L<--version|/"--version, -v">> (or B<L<-v|/"--version, -v">>)

B<textunwrap-clipboard> [B<L<--backend|/"--backend=s, -b">>=I<L<perl::modname|Sah::Schema::perl::modname>>|B<L<-b|/"--backend=s, -b">>=I<L<perl::modname|Sah::Schema::perl::modname>>] [B<L<--clipboard-manager|/"--clipboard-manager=s, -m">>=I<str>|B<L<...

=head1 DESCRIPTION

This is shortcut for something like:

 % clipget | textunwrap ... | clipadd

where L<clipget> and L<clipadd> are utilities to get text from clipboard
and set text of clipboard, respectively.

=head1 OPTIONS

C<*> marks required options.

=head2 Main options

=over

=item B<--backend>=I<s>, B<-b>

Default value:

 "Text::ANSI::Util"

Valid values:

 ["Text::ANSI::Fold","Text::ANSI::Util","Text::ANSI::WideUtil","Text::Fold","Text::LineFold","Text::WideChar::Util","Text::Wrap"]

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

If set to true, will also print result to STDOUT.

=back

=head2 Logging options

script/textunwrap-clipboard  view on Meta::CPAN


=head1 COMPLETION

This script has shell tab completion capability with support for several
shells.

=head2 bash

To activate bash completion for this script, put:

 complete -C textunwrap-clipboard textunwrap-clipboard

in your bash startup (e.g. F<~/.bashrc>). Your next shell session will then
recognize tab completion for the command. Or, you can also directly execute the
line above in your shell to activate immediately.

It is recommended, however, that you install modules using L<cpanm-shcompgen>
which can activate shell completion for scripts immediately.

=head2 tcsh

To activate tcsh completion for this script, put:

 complete textunwrap-clipboard 'p/*/`textunwrap-clipboard`/'

in your tcsh startup (e.g. F<~/.tcshrc>). Your next shell session will then
recognize tab completion for the command. Or, you can also directly execute the
line above in your shell to activate immediately.

It is also recommended to install L<shcompgen> (see above).

=head2 other shells

For fish and zsh, install L<shcompgen> as described above.

script/textwrap-clipboard  view on Meta::CPAN

#!perl

# Note: This script is a CLI for Riap function /App/TextWrapUtils/textwrap_clipboard
# 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 = '2023-04-13'; # DATE
our $DIST = 'App-TextWrapUtils'; # DIST
our $VERSION = '0.007'; # VERSION

my $cmdline = Perinci::CmdLine::Any->new(
    url => "/App/TextWrapUtils/textwrap_clipboard",
    program_name => "textwrap-clipboard",
    log => 1,
    read_config => 0,
    read_env => 0,
);

$cmdline->run;

# ABSTRACT: Wrap (fold) paragraphs in text in clipboard using one of several Perl modules
# PODNAME: textwrap-clipboard

__END__

=pod

=encoding UTF-8

=head1 NAME

textwrap-clipboard - Wrap (fold) paragraphs in text in clipboard using one of several Perl modules

=head1 VERSION

This document describes version 0.007 of textwrap-clipboard (from Perl distribution App-TextWrapUtils), released on 2023-04-13.

=head1 SYNOPSIS

B<textwrap-clipboard> B<L<--help|/"--help, -h, -?">> (or B<L<-h|/"--help, -h, -?">>, B<L<-?|/"--help, -h, -?">>)

B<textwrap-clipboard> B<L<--version|/"--version, -v">> (or B<L<-v|/"--version, -v">>)

B<textwrap-clipboard> [B<L<--backend|/"--backend=s, -b">>=I<L<perl::modname|Sah::Schema::perl::modname>>|B<L<-b|/"--backend=s, -b">>=I<L<perl::modname|Sah::Schema::perl::modname>>] [B<L<--clipboard-manager|/"--clipboard-manager=s, -m">>=I<str>|B<L<-m...

=head1 DESCRIPTION

This is shortcut for something like:

 % clipget | textwrap ... | clipadd

where L<clipget> and L<clipadd> are utilities to get text from clipboard
and set text of clipboard, respectively.

=head1 OPTIONS

C<*> marks required options.

=head2 Main options

=over

=item B<--backend>=I<s>, B<-b>

Default value:

 "Text::ANSI::Util"

Valid values:

 ["Text::ANSI::Fold","Text::ANSI::Util","Text::ANSI::WideUtil","Text::Fold","Text::LineFold","Text::WideChar::Util","Text::Wrap"]

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

If set to true, will also print result to STDOUT.

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

Default value:

script/textwrap-clipboard  view on Meta::CPAN


=head1 COMPLETION

This script has shell tab completion capability with support for several
shells.

=head2 bash

To activate bash completion for this script, put:

 complete -C textwrap-clipboard textwrap-clipboard

in your bash startup (e.g. F<~/.bashrc>). Your next shell session will then
recognize tab completion for the command. Or, you can also directly execute the
line above in your shell to activate immediately.

It is recommended, however, that you install modules using L<cpanm-shcompgen>
which can activate shell completion for scripts immediately.

=head2 tcsh

To activate tcsh completion for this script, put:

 complete textwrap-clipboard 'p/*/`textwrap-clipboard`/'

in your tcsh startup (e.g. F<~/.tcshrc>). Your next shell session will then
recognize tab completion for the command. Or, you can also directly execute the
line above in your shell to activate immediately.

It is also recommended to install L<shcompgen> (see above).

=head2 other shells

For fish and zsh, install L<shcompgen> as described above.

t/00-compile.t  view on Meta::CPAN

use Test::More;

plan tests => 7 + ($ENV{AUTHOR_TESTING} ? 1 : 0);

my @module_files = (
    'App/TextWrapUtils.pm'
);

my @scripts = (
    'script/nowrap',
    'script/nowrap-clipboard',
    'script/textunwrap',
    'script/textunwrap-clipboard',
    'script/textwrap',
    'script/textwrap-clipboard'
);

# no fake home requested

my @switches = (
    -d 'blib' ? '-Mblib' : '-Ilib',
);

use File::Spec;
use IPC::Open3;

t/author-critic.t  view on Meta::CPAN

}


use strict;
use warnings;

# this test was generated with Dist::Zilla::Plugin::Test::Perl::Critic::Subset 3.001.006

use Test::Perl::Critic (-profile => "") x!! -e "";

my $filenames = ['lib/App/TextWrapUtils.pm','script/nowrap','script/nowrap-clipboard','script/textunwrap','script/textunwrap-clipboard','script/textwrap','script/textwrap-clipboard'];
unless ($filenames && @$filenames) {
    $filenames = -d "blib" ? ["blib"] : ["lib"];
}

all_critic_ok(@$filenames);



( run in 3.467 seconds using v1.01-cache-2.11-cpan-2398b32b56e )