Boxes是一个简单的、可配置的命令行程序,它可以在其输入文本周围绘制任何类型的框。它过滤文本并在其周围绘制形状——它实际上是一个文本过滤器。事实上,它被设计为作为文本过滤器与您的编辑器集成(默认支持 Vim)。它可以绘制从简单的盒子到复杂的 ASCII 艺术的各种形状。
在本文中,我们将学习如何使用 box 实用程序在 Linux 终端中绘制形状。
如何在 Linux 中安装 Boxes 实用程序
要在 Linux 中安装Box实用程序,请使用适合您的发行版的命令。
$ sudo apt installbox [在Debian/Ubuntu上] $ sudo yum 安装框 [在CentOS/RHEL上] $ sudo dnf 安装框 [在Fedora上]
现在您已经安装了 Box,请注意它使用$HOME/.boxes
用户特定的配置文件或/etc/boxes/boxes-config系统范围的配置文件。
让我们享受Linux 终端的乐趣吧。
要查看默认框设计,只需向其提供一些输入文本,如图所示。
$ echo "嘿,这是 Example.com!感谢您关注我们。" | 盒子 /******************************************************** *****/ /* 嘿,这是 example.com!感谢您关注我们。*/ /******************************************************** *****/
要指定其他设计,请使用-d
如图所示的标志。
$ echo "嘿,这是 Example.com!感谢您关注我们。" | 盒子-d 男孩 .-“”“-。 / .===. / 6 6 / (___/) ___oo_______/_____________________ / | 嘿,这是 example.com!感谢您关注我们。| ______________________________ooo__________________/ | | | |_ | _| | | | |__|__| /-'Y'- (__/__)
要对齐或定位框中的文本,请使用标志-a
。让我们通过以下示例(其中c
表示中心)来演示它是如何工作的。
$ echo "嘿,这是 Example.com!感谢您关注我们。" | 盒子-d钻石 / / / / / ///\/ ///\/ ///\/ ///\/ ///\/ ///\///\///\///\///\///\///\///\/ //\///\/ //\///\///\///\///\///\///\///\/// \///\///\ \///嘿,这是Example.com!感谢您关注我们。/\// / / / / //\ //\ \// \// / / / / //\/ ///\ \///\///\///\///\///\///\///\///\///\///\// /\///\///\///\///\///\///\///\///\///\/// /\/// /\/// /\/// /\/// /\/// / / / / /
$ echo "Hey, this is Example.com! Thanks for following us." | boxes -d diamonds -a c / / / / / ///\/ ///\/ ///\/ ///\/ ///\/ ///\///\///\///\///\///\///\///\///\///\/ //\///\///\///\///\///\///\///\///\///\///\ \/// /\// / / / / //\ Hey, this is Example.com! Thanks for following us. //\ \// \// / / / / //\/ ///\ \///\///\///\///\///\///\///\///\///\///\// /\///\///\///\///\///\///\///\///\///\/// /\/// /\/// /\/// /\/// /\/// / / / / /
In the Christmas season, you can use the santa design to send your family and friends happy holiday messages, for example.
$ echo "Example.com wishes you a Merry Christmas and a Happy New Year 2019" | boxes -d santa .-"``"-. /______; {_______}| (/ a a )(_) (.-.).-.) _______________________ooo__( ^ )___________________________ / '-.___.-' | Example.com wishes you a Merry Christmas and a Happy New Year 2019 | ________________________________________ooo_______________________/ |_ | _| jgs ___|___/ {___|___} |_ | _| /-'Y'- (__/ __)
To list all available designs/styles, run the following command.
$ boxes -l 59 Available Styles in "/etc/boxes/boxes-config": ------------------------------------------------- ada-box (public domain), coded by Neil Bird <neil.bird@rdel.co.uk>: --------------- -- -- -- -- --------------- ada-cmt (public domain), coded by Neil Bird <neil.bird@rdel.co.uk>: -- -- regular Ada -- comments ...
It supports line justification, box size specification, text padding, indentation, use of regular expressions and much more.
Valentine’s day coming closer, and you wanted to impress your girlfriend or wife in a Linux way, then use boxes as shown.
$ echo -e "ntMe: Will you be my Valentine?ntGirl: No wayntMe: sudo will you be my Valentine?ntGirl: Yes..yes..yes! Let's go!" | boxes -d boy .-"""-. / .===. / 6 6 / ( ___/ ) _________ooo_______/_____________ / | | | 我:你愿意做我的情人吗?| | 女孩:不可能| | 我:sudo 你愿意做我的情人吗?| | 女孩:是的..是的..是的!我们走吧!| _________________ooo_________/ | | | |_ | _| | | | |__|__| /-'Y'- (__/__)
有关更多信息和示例,请访问http://boxes.thomasjensen.com/examples.html。
Boxes是一个命令行实用程序,可在其输入文本周围绘制一个框。在本文中,我们将学习如何安装和使用 box 实用程序在 Linux 终端中绘制形状。使用下面的反馈表来分享您的想法。