Skip to content
Permalink
Fetching contributors…
Cannot retrieve contributors at this time
16 lines (12 sloc) 473 Bytes
#!/usr/bin/env perl6
#| Wrap the given file at the specified column using the greedy
#| algorithm.
unit sub MAIN(
IO(Str) $file?, #= File to wrap. Defaults to standard input.
UInt :c(:$column) = 80 #= Column to wrap at. Defaults to 80.
);
($file // $*IN).comb(/ || )> \s *? \n
|| <-[ \n ]> ** { 1..($column-1) } \S )>
<?before [ \s || $ ]> <[ \s ] - [ \n ]>* \n ?
|| \S ** { $column }
/)».put;
You can’t perform that action at this time.