LinuxCommandLibrary

boxes

Draw boxes around text in terminal

TLDR

Draw a box around a string

$ echo "[string]" | boxes
copy

Remove a box from a string
$ echo "[string]" | boxes [[-r|--remove]]
copy

Specify the box design
$ echo "[string]" | boxes [[-d|--design]] [parchment]
copy

Specify the box size (in columns by lines)
$ echo "[string]" | boxes [[-s|--size]] [10]x[5]
copy

Align the box text [h]orizonally (at [l]eft, [c]enter or [r]ight)
$ echo "[string]" | boxes [[-a|--align]] h[l|c|r]
copy

Align the box text [v]ertically (at [t]op, [c]enter or [b]ottom)
$ echo "[string]" | boxes [[-a|--align]] v[t|c|b]
copy

[j]ustify the box text (at [l]eft, [c]enter or [r]ight)
$ echo "[string]" | boxes [[-a|--align]] j[l|c|r][vt]
copy

SYNOPSIS

boxes [-d box_type] [-a align] [-i indent] [-l line_length] [-n number] [-p padding] [-s style] [-t title] [-v]

PARAMETERS

-d box_type
    Specifies the type of box to draw. Use boxes -l to see the available types.

-a align
    Sets the alignment of the text within the box. Supported values are 'c' (center), 'l' (left), and 'r' (right).

-i indent
    Sets the indentation of the text inside the box. The value is the number of spaces to indent.

-l line_length
    Specifies the maximum line length of the text inside the box. Text will be wrapped to fit this length.

-n number
    Sets the number of boxes to draw around the text (nested boxes).

-p padding
    Specifies the padding around the text inside the box. The value is the number of spaces to use as padding.

-s style
    Chooses a specific style (variant) of a box type.

-t title
    Adds a title to the top of the box.

-v
    Prints version information and exits.

DESCRIPTION

The boxes command is a utility for drawing various ASCII art boxes around text input. It reads input from standard input and outputs the input enclosed within a user-specified box design to standard output. It offers a wide range of pre-defined box styles, including solid lines, dashed lines, shaded borders, and even more whimsical designs. Users can customize the box style by specifying the type of box they want to use and control the margins and padding around the enclosed text. This makes it a handy tool for adding visual emphasis to terminal output, creating decorative banners, or formatting text for scripts or configuration files.
Boxes can be used to highlight messages in scripts, generate fancy log file entries, or just add a bit of visual flair to your terminal work. The simplicity of its input and output makes it easy to integrate into existing workflows using pipes and redirection.

LISTING BOX TYPES

Running boxes -l displays a list of all available box types. This is essential to determine which box style you wish to use with the -d option.

EXAMPLES

Example usage:
boxes -d dog < input.txt
Draws a "dog" themed box around the contents of input.txt.
echo "Hello World" | boxes -d invenom
Draws "Hello World" inside an 'invenom' box.

SEE ALSO

banner(1), figlet(1), toilet(1)

Copied to clipboard