skip to navigation
skip to content

Not Logged In

colorize 0.2.1

('Command line utility to colorize other commands output',)

Latest Version: 1.0.4

Give some color to your (remote) TTY!!

VERSION DOWNLOADS TESTS COVERAGE

Installation and Usage

Two options: to install it in your system/project:

pip install colorize

And you can use it with:

python -m colorize -h

Or just download the lastest zip and use it with:

python colorize-X.Y.Z.zip -h

Now, you have two ways to use it:

Rendering the output

Just execute:

$ command to execute | python -m colorize

If you need to render both the stdout and the stderr:

$ command to execute |& python -m colorize

This method works well with too long outputs

As runner

Other way to use it:

$ python -m colorize command to execute

This method can do disgusting things with too long outputs.

Configuration File

It will find a configuration file in the current directory, in the home directory or in the default path directory. The first one found will be used. So, it will search for:

  • ./.colorize.conf
  • $HOME/.configuration/colorize/colorize.conf
  • /etc/colorize/colorize.conf

The format for this file is very easy: it is a CSV file with next fields:

# regular expression to highlight (quoted) , bold output , foreground color , background color
  "^=+$"                                   , 1           , white            ,
  "^=+$"                                   , true        , white            , black
  "^=+$"                                   , 0           , red              , white
  "^=+$"                                   , false       , brown            , magenta

Available colors:

  • black
  • white
  • red
  • green
  • blue
  • brown
  • gray
  • magenta
  • cyan

And that’s all.

Example to simulate colordiff

To emulate colordiff, just use this configuration file:

"^>.*",                0, blue
"^<.*",                0, red
"^\d+,?\d*c\d+,?\d*$", 0, magenta

That’s enough :D

 
File Type Py Version Uploaded on Size
colorize-0.2.1.tar.gz (md5) Source 2014-05-27 4KB
colorize-0.2.1.zip (md5) Source 2014-05-27 9KB
  • Downloads (All Versions):
  • 58 downloads in the last day
  • 698 downloads in the last week
  • 1721 downloads in the last month