Debian Codegraph @

scripts/clipjoin

raw
1 #!/usr/bin/perl
2
3 use strict;
4 use warnings;
5
6 # PODNAME: clipjoin
7 use Clipboard;
8
9 my $data = join '', Clipboard->paste;
10 $data =~ s/\s+\|\s+//gm;
11 $data =~ s/^\+//gm;
12 $data =~ s/\n//gms;
13 $data =~ s/\s{2,}/ /g;
14 Clipboard->copy($data);
15 print Clipboard->paste, "\n...is now in the Clipboard\n"
16 unless $ARGV[0] eq '-q';
17
18 __END__
19
20 =pod
21
22 =encoding UTF-8
23
24 =head1 NAME
25
26 clipjoin - Remove superfluous spaces from the clipboard.
27
28 =head1 VERSION
29
30 version 0.32
31
32 =head1 MOTIVATION
33
34 Often you'll copy some stuff, like this:
35
36 <ingy> hey rking, you should use YBFOD: http://search.cpan
37 | .org/~ingy/Acme-YBFOD-0.11/
38
39 Getting that URL to a browser is tedious.
40
41 Another IRC example is longer quotes:
42
43 <strunk> Objective consideration of contemporary phenomena compels the
44 conclusion that success or failure in competitive activities
45 exhibits no tendency to be commensurate with enate capacity but
46 that a considerable element of the unpredictable must invariably
47 be taken into account. I returned, and saw under the sun, that the
48 race is not to the swift, nor the battle to the strong, neither
49 yet bread to the wise, nor yet riches to men of understanding, nor
50 yet favour to men of skill, but time and chance happeneth to them all.
51
52 If you wanted to quote that to someone, you'd have \n's and " "'s
53 everywhere, unless you ran "clipjoin" first.
54
55 An example from mutt:
56
57 ,-------------------------------------------.
58 | xterm (X) |
59 +-------------------------------------------+
60 | http://www.thisisalink.com/that/wrapped/ar|
61 |+ound/a/line/and/its/a/pain/without/the/joi|
62 |+inclip/script |
63 `-------------------------------------------'
64
65 Becomes:
66 http://www.thisisalink.com/that/wrapped/around/a/line/and/its/a/pain/without/the/clipjoin/script
67
68 =head1 AUTHOR
69
70 Ryan King <[email protected]>
71
72 =head1 COPYRIGHT
73
74 Copyright (c) 2010. Ryan King. All rights reserved.
75
76 This program is free software; you can redistribute it and/or modify it
77 under the same terms as Perl itself.
78
79 See L<http://www.perl.com/perl/misc/Artistic.html>
80
81 =for :stopwords cpan testmatrix url bugtracker rt cpants kwalitee diff irc mailto metadata placeholders metacpan
82
83 =head1 SUPPORT
84
85 =head2 Websites
86
87 The following websites have more information about this module, and may be of help to you. As always,
88 in addition to those websites please use your favorite search engine to discover more resources.
89
90 =over 4
91
92 =item *
93
94 MetaCPAN
95
96 A modern, open-source CPAN search engine, useful to view POD in HTML format.
97
98 L<https://metacpan.org/release/Clipboard>
99
100 =item *
101
102 RT: CPAN's Bug Tracker
103
104 The RT ( Request Tracker ) website is the default bug/issue tracking system for CPAN.
105
106 L<https://rt.cpan.org/Public/Dist/Display.html?Name=Clipboard>
107
108 =item *
109
110 CPANTS
111
112 The CPANTS is a website that analyzes the Kwalitee ( code metrics ) of a distribution.
113
114 L<http://cpants.cpanauthors.org/dist/Clipboard>
115
116 =item *
117
118 CPAN Testers
119
120 The CPAN Testers is a network of smoke testers who run automated tests on uploaded CPAN distributions.
121
122 L<http://www.cpantesters.org/distro/C/Clipboard>
123
124 =item *
125
126 CPAN Testers Matrix
127
128 The CPAN Testers Matrix is a website that provides a visual overview of the test results for a distribution on various Perls/platforms.
129
130 L<http://matrix.cpantesters.org/?dist=Clipboard>
131
132 =item *
133
134 CPAN Testers Dependencies
135
136 The CPAN Testers Dependencies is a website that shows a chart of the test results of all dependencies for a distribution.
137
138 L<http://deps.cpantesters.org/?module=Clipboard>
139
140 =back
141
142 =head2 Bugs / Feature Requests
143
144 Please report any bugs or feature requests by email to C<bug-clipboard at rt.cpan.org>, or through
145 the web interface at L<https://rt.cpan.org/Public/Bug/Report.html?Queue=Clipboard>. You will be automatically notified of any
146 progress on the request by the system.
147
148 =head2 Source Code
149
150 The code is open to the world, and available for you to hack on. Please feel free to browse it and play
151 with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull
152 from your repository :)
153
154 L<https://github.com/shlomif/Clipboard>
155
156 git clone git://github.com/shlomif/Clipboard.git
157
158 =head1 AUTHOR
159
160 Shlomi Fish <[email protected]>
161
162 =head1 BUGS
163
164 Please report any bugs or feature requests on the bugtracker website
165 L<https://github.com/shlomif/Clipboard/issues>
166
167 When submitting a bug or request, please include a test-file or a
168 patch to an existing test-file that illustrates the bug or desired
169 feature.
170
171 =head1 COPYRIGHT AND LICENSE
172
173 This software is copyright (c) 2025 by Ryan King <[email protected]>.
174
175 This is free software; you can redistribute it and/or modify it under
176 the same terms as the Perl 5 programming language system itself.
177
178 =cut