ボックス - Linux ターミナルで ASCII アートのボックスと形状を描画します
ボックス は、入力テキストの周囲にあらゆる種類のボックスを描画できる、シンプルで構成可能なコマンド ライン プログラムです。テキストをフィルターし、その周囲に図形を描画します。これは実質的にテキスト フィルターです。実際、テキスト フィルターとしてエディターに統合されるように設計されています (Vim のデフォルトをサポートします)。単純なボックスから複雑な ASCII アートまで、さまざまな形状を描画できます。
この記事では、ボックス ユーティリティを使用して Linux ターミナルで図形を描画する方法を学びます。
Linux に Boxes ユーティリティをインストールする方法
Linux にボックスユーティリティをインストールするには、ディストリビューションに適したコマンドを使用します。
sudo apt install boxes [On Debian/Ubuntu]
sudo yum install boxes [On CentOS/RHEL]
sudo dnf install boxes [On Fedora]
これでボックスがインストールされました。$HOME/.boxes
ユーザー固有の構成ファイルまたは /etc/boxes/boxes-config システム全体の構成ファイルが使用されることに注意してください。 。
Linux ターミナルを楽しんでみましょう。
デフォルトのボックスのデザインを確認するには、図のように入力テキストを入力するだけです。
$ echo "Hey, this is linux-console.net! Thanks for following us." | boxes
/******************************************************/
/* Hey, this is linux-console.net! Thanks for following us. */
/******************************************************/
別のデザインを指定するには、次のように -d
フラグを使用します。
$ echo "Hey, this is linux-console.net! Thanks for following us." | boxes -d boy
.-"""-.
/ .===. \
\/ 6 6 \/
( \___/ )
_________________ooo__\_____/_____________________
/ \
| Hey, this is linux-console.net! Thanks for following us. |
\______________________________ooo_________________/
| | |
|_ | _|
| | |
|__|__|
/-'Y'-\
(__/ \__)
ボックス内でテキストを整列または配置するには、-a
フラグを使用します。次の例でこれがどのように機能するかを示してみましょう (c
は中央を意味します)。
$ echo "Hey, this is linux-console.net! Thanks for following us." | boxes -d diamonds
/\ /\ /\ /\ /\
/\//\\/\ /\//\\/\ /\//\\/\ /\//\\/\ /\//\\/\
/\//"///\\/\//"///\\/\//"///\\/\//"///\\/\//"///\\/\
//"//\/\\///"//\/\\///"//\/\\///"//\/\\///"//\/\\///\\
\\//\/Hey, this is linux-console.net! Thanks for following us. \/\\//
\/ \/
/\ /\
//\\ //\\
\\// \\//
\/ \/
/\ /\
//\\/\ /\//\\
\\///\\/\//"///\\/\//"///\\/\//"///\\/\//"///\\/\//"//
\/\\///"//\/\\///"//\/\\///"//\/\\///"//\/\\///"//\/
\/\\//\/ \/\\//\/ \/\\//\/ \/\\//\/ \/\\//\/
\/ \/ \/ \/ \/
$ echo "Hey, this is linux-console.net! Thanks for following us." | boxes -d diamonds -a c
/\ /\ /\ /\ /\
/\//\\/\ /\//\\/\ /\//\\/\ /\//\\/\ /\//\\/\
/\//"///\\/\//"///\\/\//"///\\/\//"///\\/\//"///\\/\
//"//\/\\///"//\/\\///"//\/\\///"//\/\\///"//\/\\///\\
\\//\/ \/\\//
\/ \/
/\ /\
//\\ Hey, this is linux-console.net! Thanks for following us. //\\
\\// \\//
\/ \/
/\ /\
//\\/\ /\//\\
\\///\\/\//"///\\/\//"///\\/\//"///\\/\//"///\\/\//"//
\/\\///"//\/\\///"//\/\\///"//\/\\///"//\/\\///"//\/
\/\\//\/ \/\\//\/ \/\\//\/ \/\\//\/ \/\\//\/
\/ \/ \/ \/ \/
クリスマス シーズンには、サンタ デザインを使用して、家族や友人にハッピー ホリデー メッセージを送信することができます。
$ echo "linux-console.net wishes you a Merry Christmas and a Happy New Year 2019" | boxes -d santa
.-"``"-.
/______; \
{_______}\|
(/ a a \)(_)
(.-.).-.)
_______________________ooo__( ^ )___________________________
/ '-.___.-' \
| linux-console.net wishes you a Merry Christmas and a Happy New Year 2019 |
\________________________________________ooo_______________________/
|_ | _| jgs
\___|___/
{___|___}
|_ | _|
/-'Y'-\
(__/ \__)
使用可能なすべてのデザイン/スタイルを一覧表示するには、次のコマンドを実行します。
$ boxes -l
59 Available Styles in "/etc/boxes/boxes-config":
-------------------------------------------------
ada-box
(public domain), coded by Neil Bird <[email >:
---------------
-- --
-- --
---------------
ada-cmt
(public domain), coded by Neil Bird <[email >:
--
-- regular Ada
-- comments
...
行揃え、ボックス サイズの指定、テキスト パディング、インデント、正規表現の使用などをサポートします。
バレンタインデーが近づいてきたので、Linux の方法でガールフレンドや妻に好印象を与えたいと考えた場合は、次のようなボックスを使用します。
$ echo -e "\n\tMe: Will you be my Valentine?\n\tGirl: No way\n\tMe: sudo will you be my Valentine?\n\tGirl: Yes..yes..yes! Let's go!" | boxes -d boy
.-"""-.
/ .===. \
\/ 6 6 \/
( \___/ )
_________ooo__\_____/_____________
/ \
| |
| Me: Will you be my Valentine? |
| Girl: No way |
| Me: sudo will you be my Valentine? |
| Girl: Yes..yes..yes! Let's go! |
\______________________ooo_________/
| | |
|_ | _|
| | |
|__|__|
/-'Y'-\
(__/ \__)
詳細と例については、http://boxes.thomasjensen.com/examples.html を参照してください。
ボックスは、入力テキストの周囲にボックスを描画するコマンド ライン ユーティリティです。この記事では、Linux ターミナルに図形を描画するためのボックス ユーティリティをインストールして使用する方法を学びます。以下のフィードバック フォームを使用して、それについてのご意見を共有してください。