Section: User Commands (1)
Updated: April 04 2019
| Return to Main Contents
boxes - text mode box and comment drawing filter
[-hlmrv] [-a format] [-d design] [-f file] [-i indent] [-k bool]
[-p pad] [-s size] [-t tabopts] [infile [outfile]]
is a text filter which can draw any kind of box around its input text. Box
design choices range from simple boxes to complex ASCII art. A box can also
be removed and repaired, even if it has been badly damaged by editing of the
text inside. Since boxes may be open on any side,
can also be used to create regional comments in any programming language.
New box designs of all sorts can easily be added and shared by appending to
a configuration file.
is a command line tool, but also integrates with any text editor that
supports filters. The
website has examples on how to configure editor integration for various
Options offered by
are the following:
- -a string
Alignment/positioning of text inside box. This option takes a format string
argument which is read from left to right. The format string may not
contain whitespace and must consist of one or more of the following
- horizontal alignment of the input text block inside a potentially larger
box. Possible values for
(ell, for left alignment),
(right). This does not affect the justification of text lines within the
input text block (use the
- vertical alignment of the input text block inside a potentially larger
box. Possible values for
(for top alignment),
- justification of lines within the input text block. Possible values for
(ell, for left justification),
(right). This does not affect the alignment of the input text block itself
within the box. Use the
arguments for input text block positioning.
Short hand notations (can be combined with the above arguments):
(ell) - short for
- short for
- short for
The factory default setting for
- -c string
Command line design definition for simple cases. The argument of this
option is the definition for the "west" (W) shape. The defined shape must
consist of exactly one line, i.e. no multi-line shapes are allowed. The
option is intended as a shortcut for those cases where simple regional
comments are to be created, which only need a certain character or sequence
of characters to be placed in front of every line. In such cases, it is
much more convenient to simply specify
than to do a complete design definition in one's config file, where the
only shape defined is the west shape.
This option implies a
and does not access the config file.
may of course be used in conjunction with any of the other options. By default,
is not specified.
- -d string
Design selection. The one argument of this option is the name of the design to
- -f string
Use alternate config file. The one argument of this option is the name of a
config file, containing new and exciting designs!
Print usage information.
- -i string
Indentation mode. Possible arguments are "text" (indent text inside of
box), "box" (indent box, not text inside of box), or "none" (throw away
indentation). Arguments may be abbreviated. The default is to indent the
box, but not the text.
- -k bool
Kill leading/trailing blank lines on removal. The value of
can be specified as on, yes, true, 1, or t, all meaning yes, or off, no,
false, 0, or f, which mean no. This is case-insensitive. This option only
takes effect in connection with
If set to yes, leading and trailing blank lines will be removed from the
output. If set to no, the entire content of the former box is returned.
The default is no, if both the top and the bottom part of the box are open,
as is the case with most regional comments. If the box's design defines a
top part or a bottom part, the default is yes.
(ell) List designs. Produces a listing of all available box designs in the
config file, along with a sample box and information about it's creator.
Also checks syntax of the entire config file. If used in connection with
displays detailed information about the specified design.
Mend box. This removes a (potentially broken) box as with
and redraws it afterwards. The mended box is drawn according to the
options given. This may be important to know when it comes to restoring
padding, indentation, etc. for the mended box. Implies
- -p string
Padding. Specify padding in spaces around the input text block for all
sides of the box. The argument string may not contain whitespace and must
consist of a combination of the following characters, each followed by a
number indicating the padding in spaces:
- (all) give padding for all sides at once
- (horiz) give padding for both horizontal sides
- (vertical) give padding for both vertical sides
- (bottom) give padding for bottom (south) side
- (left) give padding for left (west) side
- (top) give padding for top (north) side
- (right) give padding for right (east) side
would define the padding to be 4 characters on all sides, except for the
top of the box, where the input text block will be only 2 lines away from
By default, unless specified otherwise in the config file, no padding is
Remove box. Removes an existing box instead of drawing it. Which design to
use is detected automatically. In order to save time or in case the
detection does not decide correctly, combine with
to specify the design. The default is to draw a new box.
- -s widthxheight
Box size. This option specifies the desired box size in units of columns
(for width) and lines (for height).
If only a single number is given as argument, this number specifies the
desired box width. A single number prefixed by 'x' specifies only the box
height. The actual resulting box size may vary depending on the individual
shape sizes of the chosen design. Also, other command line options may
influence the box size (such as
By default, the smallest possible box is created around the text.
- -t string
Tab handling. This option controls how tab characters in the input text are
handled. The option string must always begin with a
number indicating the distance between tab stops. It is important that this
value be set correctly, or tabulator characters will upset your input text.
The correct tab distance value depends on the settings used for the text
you are processing. A common value is 8.
Immediately following the tab distance, an optional character can be appended,
how to treat the leading tabs. The following options are available:
- expand tabs into spaces
- keep tabs as close to what they were as possible
- unexpand tabs. This makes
turn as many spaces as possible into tabs.
In order to maintain backwards compatibility, the
can be just a number. In that case,
is assumed for tab handling, which removes all tabs and replaces them with
spaces. The factory default for the
option is simply 8, which is just such a case.
For example, you could specify
in order to have your leading tabs unexpanded. In the box content, tabs are
always converted into spaces. The tab distance in this example is 4.
Print out current version number.
will use the configuration file specified on the command line (using
If no config file is specified on the command line,
will check for the BOXES environment variable, which may contain a filename
to use. If BOXES is not set,
will try to read $HOME/.boxes and use it as a config file. Failing that,
will try to read the system-wide config file (see FILES).
The syntax of
config files is described on the website.
website is https://boxes.thomasjensen.com/
. It contains a number
of examples illustrating this manual page as well as more in-depth
was made by Thomas Jensen and many great contributors.
For a full list, see
Please refer to the
website for the maintainer's current email address.
Any currently known bugs, and also any current feature requests are tracked
on GitHub: https://github.com/ascii-boxes/boxes/issues
recognizes the following environment variables:
The user's home directory.
configuration file, if different from ~/.boxes.
configuration file (takes precedence over system-wide configuration file)
system-wide configuration file
- CONFIGURATION FILES
- SEE ALSO
This document was created by
using the manual pages.
Time: 19:21:27 GMT, April 05, 2019
Page created April 06, 1999, last touched: 05-Apr-2019.