toys

Tools and things that make my life easier - y'all might like them too

View the Project on GitHub pfuntner/toys

banner

Purpose

Prints a message in a banner. I often use this inside scripts or in interactive loop as an eye catcher.

Syntax

Syntax: banner [--character C] [--box] [--left] [--center] [--middle] [--right] [--color COLOR] [text ...]

Options and arguments

| Option | Description | Default | | —— | ———– | ——- | | --character C | Use C as the border character | The default is to use use a box-style border. See --box. | | --box | Toggles use of the box-style border: corner characters, vertical bars on the sides, and horizontal bars on the top and bottom. If box-style borders are disabled and an alternate character is not specified, a hash character is used instead. | The default is to use use a box-style border. | | --left | Text is left-justified, assuming there are multiple lines of text. | This is the default | | --center | Text is centered, assuming there are multiple lines of text. | The default is to left-justified text | | --right | Text is right-justified, assuming there are multiple lines of text. | The default is to left-justified text | | --color COLOR | Print the banner in a specific color. This must be one of: black, blue, brown, cyan, darkgray, green, lightblue, lightcyan, lightgray, lightgreen, lightpurple, lightred, orange, purple, red, white, or yellow but best effors are taken to normalize input (eg: Light Red) and accept unambiguous abbreviations (eg: blu). | The default is the default foreground color for the terminal. This is typically customizable by your emulator/terminal so to definitively say the default is black or white is inaccurate. |

Examples

$ banner hello
┏━━━━━━━┓
┃ hello ┃
┗━━━━━━━┛
$ echo -e "The time is\n$(date)" | banner --center --box
################################
#         The time is          #
# Wed Nov  1 16:55:59 EDT 2017 #
################################
$

Color

Example of banner with --color option

Example of all colors