°Ô½Ã¹° 1,369°Ç
   
Colout - Color Up Arbitrary Command Output
±Û¾´ÀÌ : ÃÖ°í°ü¸®ÀÚ ³¯Â¥ : 2016-08-16 (È­) 18:11 Á¶È¸ : 3762
±ÛÁÖ¼Ò :
                                
Å×½ºÆ® ȯ°æ
 OS : Ubuntu 14.04 LTS

colout - Å͹̳ΠÅؽºÆ®¿¡ »ö±òÀ» ÀÔÈ÷´Â ¸í··¾î
install
# apt-get install python-setuptools
# easy_install colout


example
<text stream> | colout <pattern to color> [color [style]]

# tail -n 10 /var/log/boot.log |colout OK
OK ´Ü¾î°¡ Æ÷ÇԵȰ͸¸ ºÓÀº»ö(±âº»)À¸·Î Ç¥½Ã


# tail -n 10 /var/log/boot.log |colout OK yellow bold
OK ´Ü¾î°¡ Æ÷ÇԵȰ͸¸ ³ë¶õ»öÀ¸·Î Ç¥½Ã


#  tail -n 10 /var/log/boot.log |colout  "^.*OK.*$" red bold


Color maps
# tail /var/log/boot.log |colout "^.*$" rainbow


-c ¿É¼ÇÀ» »ç¿ëÇؼ­ ¶óÀθ¶´Ù »ö»ó ÁöÁ¤
# tail /var/log/boot.log | colout -c "^.*$" blue,yellow,white normal


°¢ ¶óÀθ¶´Ù ·£´ýÇÑ »ö»óÀ¸·Î Ç¥½Ã
# tail /var/log/boot.log | colout "^.*$" random


Source Code °­Á¶
colout -s [PATTERN] [COLOR]
# tail -n 20 /etc/openstack-dashboard/local_settings.py | grep -v "^\s*$" | colout -s Python monokai



# colout  --help
usage: colout.py [-h] [-g] [-c] [-l SCALE] [-a] [-t] [-T DIR] [-P DIR] [-r]
                 [--debug] [-s]
                 REGEX [COLOR] [STYLE]

A regular expression based formatter that color up an arbitrary text stream.

positional arguments:
  REGEX                 A regular expression
  COLOR                 A number in [0¡¦255], a color name, a colormap name,
                        a palette or a comma-separated list of those values.
  STYLE                 One of the available styles or a comma-separated list
                        of styles.

optional arguments:
  -h, --help            show this help message and exit
  -g, --groups          For color maps (random, rainbow), iterate over
                        matching groups in the pattern instead of over
                        patterns
  -c, --colormap        Use the given colors as a colormap (cycle the colors
                        at each match)
  -l SCALE, --scale SCALE
                        When using the 'scale' colormap, parse matches as
                        decimal numbers (taking your locale into account) and
                        apply the rainbow colormap linearly between the given
                        SCALE=min,max
  -a, --all             Color the whole input at once instead of line per line
                        (really useful for coloring a source code file with
                        strings on multiple lines).
  -t, --theme           Interpret REGEX as a theme.
  -T DIR, --themes-dir DIR
                        Search for additional themes (colout_*.py files) in
                        this directory
  -P DIR, --palettes-dir DIR
                        Search for additional palettes (*.gpl files) in this
                        directory
  -r, --resources       Print the names of all available colors, styles,
                        themes and palettes.
  --debug               Debug mode: print what's going on internally, useful
                        if you want to check what features are available.
  -s, --source          Interpret REGEX as a source code readable by the
                        Pygments library. If the first letter of PATTERN is
                        upper case, use the 256 colors mode, if it is lower
                        case, use the 8 colors mode. Interpret COLOR as a
                        Pygments style.

Á»´õ ´Ù¾çÇÑ ¿¹Á¦´Â ¾Æ·¡ ¸µÅ©Âü°í
Âü°í  http://nojhan.github.io/colout/
        https://github.com/nojhan/colout


À̸§ Æнº¿öµå
ºñ¹Ð±Û (üũÇÏ¸é ±Û¾´À̸¸ ³»¿ëÀ» È®ÀÎÇÒ ¼ö ÀÖ½À´Ï´Ù.)
¿ÞÂÊÀÇ ±ÛÀÚ¸¦ ÀÔ·ÂÇϼ¼¿ä.
   

 



 
»çÀÌÆ®¸í : ¸ðÁö¸®³× | ´ëÇ¥ : ÀÌ°æÇö | °³ÀÎÄ¿¹Â´ÏƼ : ·©Å°´åÄÄ ¿î¿µÃ¼Á¦(OS) | °æ±âµµ ¼º³²½Ã ºÐ´ç±¸ | ÀüÀÚ¿ìÆí : mojily°ñ¹ðÀÌchonnom.com Copyright ¨Ï www.chonnom.com www.kyunghyun.net www.mojily.net. All rights reserved.