mdisk: Use color, red for error messages and green for success
[sunny256-utils.git] / cutfold
blob1dd150d6f35d197eec879f802dfb7f554fc935ee
1 #!/usr/bin/env perl
3 # cutfold
4 # File ID: d8de5ac8-5d37-11df-a137-90e6ba3022ac
5 # Inserts “CUT” marks with Vim fold before and after stdin.
6 # Select text in visual line mode and filter the block through this script.
8 use strict;
9 use warnings;
11 $| = 1;
13 my $Line = <STDIN>;
14 my ($Indent, $Title) = ("", "CUT");
16 defined($ARGV[0]) && ($Title = join(" ", @ARGV));
17 $Line =~ /^(\s+)/ && ($Indent = $1);
18 print("======== $Title \x7B\x7B\x7B ========\n$Line");
20 while (<STDIN>) {
21 print($_);
24 print("======== \x7D\x7D\x7D $Title ========\n");