You are not logged in.

#1 2019-03-25 08:23:22

From: Sweden
Registered: 2008-08-27
Posts: 878

hr - a <hr> for your terminal!

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.

    -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 … tra/hr.png

Some examples of usage:

    # display a yellow underlined bar using the default '=' character
    hr -fg 220 --underline … mple01.png

    # display a red solid bar padded by 10 columns from right and left
    hr -fg 160 -c ▀ --pre 10 --post 10 … mple02.png

    # display a solid grey, thick bar using ascii character _ and the bold,
    # underline and reverse video attributes
    hr -fg 240 -c_ -bur … mple03.png

    # 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 … mple04.png

    # use all options at once, because why not?
    hr -c ! -fg 52 -bg 196 -biur -s 70 -pre 5 -post 5 … mple05.png

    # use several characters to form a bar using arithmetics
    hr -c "  japh  " -fg 1 -bg 0 -b -s $(($COLUMNS / 8)) … mple06.png


# cpan App::term::hr


# cpan Term::ExtendedColor
$ git clone
$ cd hr
$ perl Makefile.PL
$ make
# make install

moderator edit -- replaced oversized images with links.
Pasting pictures and code

Last edited by 2ManyDogs (2019-03-25 13:12:19)


Board footer

Powered by FluxBB