92
51

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

figlet (文字、テキストのアスキーアート生成するコマンド)

Last updated at Posted at 2017-12-17

figletとは

まれによくみる文字のアスキーアート的なアレ

$ figlet -f rectangles Qiita

  _____ _ _ _       
 |     |_|_| |_ ___ 
 |  |  | | |  _| .'|
 |__  _|_|_|_| |__,|
    |__|    

を生成するコマンド。

インストール

macなら

$ brew install figlet

オススメフォント一覧

何の文字をサンプルにするか悩んだんですが

mig.gif

これにしましょう。wasted。

standard

figlet -f standard wasted
                   _           _ 
__      ____ _ ___| |_ ___  __| |
\ \ /\ / / _` / __| __/ _ \/ _` |
 \ V  V / (_| \__ \ ||  __/ (_| |
  \_/\_/ \__,_|___/\__\___|\__,_|

chunky

figlet -f chunky wasted        
                       __            __ 
.--.--.--.---.-.-----.|  |_.-----.--|  |
|  |  |  |  _  |__ --||   _|  -__|  _  |
|________|___._|_____||____|_____|_____|

bulbhead

figlet -f bulbhead wasted   
 _    _    __    ___  ____  ____  ____  
( \/\/ )  /__\  / __)(_  _)( ___)(  _ \ 
 )    (  /(__)\ \__ \  )(   )__)  )(_) )
(__/\__)(__)(__)(___/ (__) (____)(____/ 

larry3d

figlet -f larry3d wasted 
                             __              __     
                            /\ \__          /\ \    
 __  __  __     __      ____\ \ ,_\    __   \_\ \   
/\ \/\ \/\ \  /'__`\   /',__\\ \ \/  /'__`\ /'_` \  
\ \ \_/ \_/ \/\ \L\.\_/\__, `\\ \ \_/\  __//\ \L\ \ 
 \ \___x___/'\ \__/.\_\/\____/ \ \__\ \____\ \___,_\
  \/__//__/   \/__/\/_/\/___/   \/__/\/____/\/__,_ /

ogre

figlet -f ogre wasted        
                   _           _ 
__      ____ _ ___| |_ ___  __| |
\ \ /\ / / _` / __| __/ _ \/ _` |
 \ V  V / (_| \__ \ ||  __/ (_| |
  \_/\_/ \__,_|___/\__\___|\__,_|

rectangles

figlet -f rectangles wasted        
                           
               _         _ 
 _ _ _ ___ ___| |_ ___ _| |
| | | | .'|_ -|  _| -_| . |
|_____|__,|___|_| |___|___|


smisome1

figlet -f smisome1 wasted        
    ___       ___       ___       ___       ___       ___   
   /\__\     /\  \     /\  \     /\  \     /\  \     /\  \  
  /:/\__\   /::\  \   /::\  \    \:\  \   /::\  \   /::\  \ 
 /:/:/\__\ /::\:\__\ /\:\:\__\   /::\__\ /::\:\__\ /:/\:\__\
 \::/:/  / \/\::/  / \:\:\/__/  /:/\/__/ \:\:\/  / \:\/:/  /
  \::/  /    /:/  /   \::/  /   \/__/     \:\/  /   \::/  / 
   \/__/     \/__/     \/__/               \/__/     \/__/  

slant, smslant

figlet -f slant wasted 
                      __           __
 _      ______ ______/ /____  ____/ /
| | /| / / __ `/ ___/ __/ _ \/ __  / 
| |/ |/ / /_/ (__  ) /_/  __/ /_/ /  
|__/|__/\__,_/____/\__/\___/\__,_/   
 figlet -f smslant wasted        
                  __         __
 _    _____ ____ / /____ ___/ /
| |/|/ / _ `(_-</ __/ -_) _  / 
|__,__/\_,_/___/\__/\__/\_,_/  

thin

figlet -f thin wasted  
                              
               |             |
. . .,---.,---.|--- ,---.,---|
| | |,---|`---.|    |---'|   |
`-'-'`---^`---'`---'`---'`---'

goofy

ネガティブスペース的な

figlet -f goofy wasted 
    ____    _____  ______       ___        __        __     ___
|  |    |  |    /  \     )  ____) (__    __) \    ___) |    \  
|  |    |  |   /    \   (  (___      |  |     |  (__   |     | 
|  |    |  |  /  ()  \   \___  \     |  |     |   __)  |     | 
 \  \/\/  /  |   __   |  ____)  )    |  |     |  (___  |     | 
__\      /___|  (__)  |_(      (_____|  |____/       )_|    /__

映画ネタ

starwars

figlet -w60 -f starwars starwars
     _______.___________.    ___      .______      
    /       |           |   /   \     |   _  \     
   |   (----`---|  |----`  /  ^  \    |  |_)  |    
    \   \       |  |      /  /_\  \   |      /     
.----)   |      |  |     /  _____  \  |  |\  \----.
|_______/       |__|    /__/     \__\ | _| `._____|
                                                   
____    __    ____  ___      .______          _______.
\   \  /  \  /   / /   \     |   _  \        /       |
 \   \/    \/   / /  ^  \    |  |_)  |      |   (----`
  \            / /  /_\  \   |      /        \   \    
   \    /\    / /  _____  \  |  |\  \----.----)   |   
    \__/  \__/ /__/     \__\ | _| `._____|_______/    

trek

figlet -f trek startrek
  .dBBBBP dBBBBBBP dBBBBBb   dBBBBBb dBBBBBBP dBBBBBb    dBBBP  dBP dBP
  BP                    BB       dBP              dBP          d8P.dBP 
  `BBBBb   dBP      dBP BB   dBBBBK   dBP     dBBBBK   dBBP   dBBBBP   
     dBP  dBP      dBP  BB  dBP  BB  dBP     dBP  BB  dBP    dBP BB    
dBBBBP'  dBP      dBBBBBBB dBP  dB' dBP     dBP  dB' dBBBBP dBP dBP 

もっと見たい方

FIGlet fonts library - Font overview

使いどころ

例えばコマンド打ち間違えたらwastedって出てくる

zshrc
# bashなら command_not_found_handler() -> command_not_found_handle()
function command_not_found_handler(){
    echo -e     "\e[31m                        __            __ \n" \
                ".--.--.--.---.-.-----.|  |_.-----.--|  |\n" \
                "|  |  |  |  _  |__ --||   _|  -__|  _  |\n" \
                "|________|___._|_____||____|_____|_____|\n"
}

wasted2.gif

※ 無駄な実装で無駄になったコマンドをwastedと知らせる無駄な状況

まとめ

これでみなさんも文字のAA作り放題!やったね!

追記:Qiitaのコードブロックは行間広くて見づらかったかも。

92
51
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
92
51

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?