Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lonetwin/colorize
*nixy filter that adds color to its standard input by rows or columns
https://github.com/lonetwin/colorize
cli color python unix-pipes
Last synced: 3 months ago
JSON representation
*nixy filter that adds color to its standard input by rows or columns
- Host: GitHub
- URL: https://github.com/lonetwin/colorize
- Owner: lonetwin
- License: mit
- Created: 2017-03-17T19:42:00.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-03-12T20:46:46.000Z (over 5 years ago)
- Last Synced: 2024-05-15T13:05:33.000Z (6 months ago)
- Topics: cli, color, python, unix-pipes
- Language: Python
- Homepage:
- Size: 15.6 KB
- Stars: 84
- Watchers: 5
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
colorize
========\*nixy filter that adds color to its standard input by rows or columns
Example usage
* output alternate rows in different colors::
$ ls -l | colorize.py -a
$ ls -l | colorize.py -a green,blue* output each space separated column from stdin in a different color::
$ tail -f logfile | colorize.py
$ tail -f logfile | colorize.py -c green,blue,red,yellow* output the first 3 space separated columns in different colors and all subsequent text in one color::
$ tail -f logfile | colorize.py 3
$ tail -f logfile | colorize.py -c green,blue,red 3* output the columns specified by widths in different colors
::
# - The first 10 characters is green, the next 12 in red, followed by space
# separated columns alternating in green and red
$ tail -f logfile | colorize.py -c green:10,red:12# - The first 10 characters in green, the next 12 in red, all subsequent text in yellow
$ tail -f logfile | colorize.py -c green:10,red:12,yellow 3# - The first 10 characters in the default first color (blue), the next 12 in green,
# the next space separated column in red, the subsequent text in yellow
$ tail -f logfile | colorize.py -c :10,green:12,red,yellow 4* filter the output of tail -f, coloring lines from each file in different color::
$ tail -f first.log second.log | colorize.py -t
$ tail -f first.log second.log | colorize.py -t green,yellowDemo
====
|demo|Usage Tip
=========If you use `bash`, you can create colorized versions of commands, like::
function ctail() { tail $@ | colorize.py -t; }
function cll() { ls -l $@ | colorize.py 8; }
function cvmstat() { vmstat $@ | colorize.py -a red,green; }.. |demo| image:: https://asciinema.org/a/107799.png
:target: https://asciinema.org/a/107799?speed=2