App-term-hr
view release on metacpan or search on metacpan
DESCRIPTION
hr prints a horisontal bar in your terminal. Useful when you run a
chain of commands that might produce a lot of output and you need to
differentiate where a given output is coming from.
OPTIONS
-c, --char Character to use
-s, --size Number of columns.
-fg, --fg Foreground color to use. See Term::ExtendedColor
-bg, --bg Background color to use. See Term::ExtendedColor
-b, --bold Use bold
-i, --italic Use italics
-u, --underline Use underline
-r, --reverse Use reverse video
-h, --help display this help and exit
-v, --version display version info and exit
AUTHOR
Magnus Woldrich
CPAN ID: WOLDRICH
use strict;
use warnings;
use utf8;
use Pod::Usage;
use Getopt::Long qw(GetOptions);
Getopt::Long::Configure('bundling_override');
use Term::ExtendedColor qw(fg bg bold);
#< options
my %opt = (
char => '=',
size => undef,
pre => 0,
post => 0,
);
? ";38;5;$_[1]"
: "38;5;$_[1]"
},
'bg:i' => sub {
$attributes .= ($attributes !~ m/^$/)
? ";48;5;$_[1]"
: "48;5;$_[1]"
},
'b|bold' => sub {
$attributes .= ($attributes !~ m/^$/)
? ";1"
: "38;5;1"
},
'i|italic' => sub {
$attributes .= ($attributes !~ m/^$/)
? ";3"
: "3"
},
=head1 OPTIONS
-c, --char Character to use
-s, --size Number of columns
-pre, --pre Pad the left side with whitespace n
-post, --post Pad the right side with whitespace n
-fg, --fg Foreground color to use, int 0-255
-bg, --bg Background color to use, int 0-255
-b, --bold Use bold
-i, --italic Use italics
-u, --underline Use underline
-r, --reverse Use reverse video
-h, --help Display this help and exit
-m, --man Display the manual and exit
-v, --version Display version info and exit
=head1 EXAMPLES
# display a yellow underlined bar using the default '=' character
hr -fg 220 --underline
# display a red solid bar padded by 10 columns from right and left
hr -fg 160 -c â --pre 10 --post 10
# display a solid grey, thick bar using ascii character _ and the bold,
# underline and reverse video attributes
hr -fg 240 -c_ -bur
# display a bar made of dots, with 5 column spacing one each size
# and 20 columns wide.
hr -fg 197 -c· -pre 5 -post 5 -size 20
# use all options at once, because why not?
( run in 2.186 seconds using v1.01-cache-2.11-cpan-99c4e6809bf )