BOBOBK

boxes: An Interesting Command-Line String Shaping Tool

MISCELLANEOUS

When frequently using GitHub, you may notice others’ repository code help information or website source code always has beautifully shaped patterns made of strings, but your own code lacks these decorations and looks plain. So how can you generate such stylish string shapes? The answer is to use the interesting command-line string shaping tool boxes.

Let’s look at an example first

yum install boxes -y
echo "this is my first command line\n shape text  created by boxes" | boxes -d diamonds -a hcvc

boxes is included in most Linux distributions, you only need to install it using the built-in package manager. Here is an example using CentOS:

yum install boxes -y

boxes is a simple and practical application that wraps text in ASCII art style string shapes. The default shape style is source code comment style, which is what most people need. It also provides other options, like dogs, diamonds, etc. The above image uses the diamond shape. Let’s try the dog shape:


echo "this is my first command line\n shape text  created by boxes" | boxes -d dog -a hcvc
          __   _,--="=--,_   __
         /  \."    .-.    "./  \
        /  ,/  _   : :   _  \/` \
        \  `| /o\  :_:  /o\ |\__/
         `-'| :="~` _ `~"=: |
            \`     (_)     `/
     .-"-.   \      |      /   .-"-.
.---{     }--|  /,.-'-.,\  |--{     }---.
 )  (_)_)_)  \_/`~-===-~`\_/  (_(_(_)  (
(     this is my first command line     )
 )     shape text  created by boxes    (
'---------------------------------------'

Generate your own text patterns

Isn’t it cool? Actually, you can design your own shapes. For details, please refer to https://boxes.thomasjensen.com/docs. After generating your design, paste the text into your program code. Here is the peek shape as an example:


echo "this is my first command line\n shape text  created by boxes" | boxes -d peek -a hcvc
/*       _\|/_
         (o o)
 +----oOO-{_}-OOo--------------+
 |this is my first command line|
 | shape text  created by boxes|
 +----------------------------*/

Related