Raffaello - output colorizer
============================
Raffaello colorizes the output stream of any command-line tool
(e.g. gcc/g++, cmake, dmesg, syslog and custom), making it easier to
read.
Usage
-----
The raffaello’s command line interface let you use two call modes:
**pipes** and **command**.
In pipe mode you call raffaello like:
::
<output stream source> | raffaello [options]
In command mode raffaello will call your stream source in your behalf
::
raffaello [options] -c <output stream source>
To highlight the output stream, Raffaello has **2 color modes** and **2
styles modes**:
Color modes:
- **8 colors** mode let you use the following names: *black, red,
green, yellow, blue, magenta, cyan, light_gray*. **NEW** Starting
from version 3.0.3 Raffaello introduces a *blind* color: *lines
matching the pattern with color “blind” will be REMOVED from the
stream*. This will improve readability of dense stream output.
- **256 colors** mode let you use other 248 colors and choose between
foreground or background colors (you can mix 8 colors mode names with
256 color mode names):
Color styles:
- Foreground color names are in the form ``colorNUM``. E.g. foreground
red is *color001*
- Background color names are in the form ``bgcolorNUM``. E.g.
background red is *bgcolor001*
With the styles you can blend colors in **bold** and **underlined**
- foreground red bold is *color001_bold*
- foreground red underlined is *color001_underlined*
Call ``raffaello -l`` to see the complete list of available colors.
Full interface description
~~~~~~~~~~~~~~~~~~~~~~~~~~
::
Usage: raffaello (-p PRESET | -r REQUEST | -f FILE | -l) [options]
-p PRESET, --preset=PRESET Prebuilt config files for coloring known output streams (gcc/g++, cmake, dmesg, gcc/g++, ModemManager, logcat...)
-r REQUEST --request=REQUEST The requested text/color mapping string. Multipe requests are separated by a space. Regular expression are supported. E.g. "error=>red [Ww]arning=>yellow_bold".
-f FILE --file=FILE Path to the custom text=>color configuration file.
-c COMMAND --command=COMMAND Instead of using raffaello with pipes, set the command-line tool to be executed by raffaello directly. E.g. -c "dmesg -w".
-m, --match-only Print only the lines that match against some defined pattern.
-d DELIMITER --delimiter=DELIMITER If you don't like "=>" as delimiter between text and color, use this flag to change it. E.g. -d & [default: =>]
-l, --list List all the available colors and presets
-v --verbose Enable debug logging
**NEWS** - version 3.0.3 –match-only flag Print only the lines that
match against any defined pattern.
Examples
--------
The simpler usage is using the ``request`` flag. The ``request`` flag
requires a string in the form “text=>color anothertext=>anothercolor”,
where text can be a constant string or a `Regular
expression <https://docs.python.org/2/library/re.html>`__, while color
is the name of the color to use (see `Usage <#Usage>`__ section)
- Simple constant text highlight
::
$ ifconfig eno1 | raffaello --request="collisions=>blue"
example001
- Highlight of multiple texts. Here you can see that spaces in the
“text part” are not allowed. Use :raw-latex:`\s `instead.
::
$ ifconfig eno1 | raffaello --request="RX\spackets=>green TX\spackets=>red"
example002
- Highlight with regular expressions
::
$ ifconfig eno1 | raffaello --request="\d+\.\d+\.\d+\.\d+=>green_bold"
example003
For more complex color mapping you can write a file with a line for each
*text=>color* entry, like the following
::
collisions=>blue
RX\spackets=>green
TX\spackets=>red
\d+\.\d+\.\d+\.\d+=>green_bold
save the file and provide it to raffaello using its fullpath
::
$ ifconfig eno1 | raffaello --file=$HOME/colorfile
example004
Color files can be reused in other color files using the ``include``
directive followed by the fullpath to the file.
Using fullpath is annoying, tough, so Raffaello has a special path under
$HOME/.raffaello. All the colorfiles inside this folder can be passed
using simply their filename, without the path.
::
# include custom colorfile in $HOME/.raffaello
include some_custom_colorfile
# include custom color outside $HOME/.raffaello
include $HOME/path/to/some_other_custom_color
collisions=>blue
RX\spackets=>green
TX\spackets=>red
\d+\.\d+\.\d+\.\d+=>green_bold
Raffaello provides some built-in colorfiles, called **presets**, for
known tools like cmake, gcc/g++, dmesg, etc. The presets can be used
alone using ``--preset`` flag or even included in custom colorfile in
order to extend their colormaps.
::
# Include a preset colorfile
include errors
# include custom colorfile in $HOME/.raffaello
include some_custom_colorfile
# include custom color outside $HOME/.raffaello
include $HOME/path/to/some_other_custom_color
collisions=>blue
RX\spackets=>green
TX\spackets=>red
\d+\.\d+\.\d+\.\d+=>green_bold
For a full list of presets, call ``raffaello --list``.
Raffaello is a python module
----------------------------
Raffaello can be used as a python module inside other source codes
.. code:: python
from raffaello import Raffaello, Commission
request = '''
error=>red
warning=>yellow_bold
bluish\stext=>color026
'''
c = Commission(request)
r = Raffaello(c.commission)
print(r.paint('Sample message with error, warning and a bluish text.'))
Install
-------
Install from source using setuptools. Just type the following command
::
# python setup.py install
Install from `PyPI - the Python Package
Index <https://pypi.python.org/pypi>`__
::
# pip install raffaello
Dependencies
------------
- ``docopt`` language for description of command-line interfaces
.. |PyPI version| image:: vertopal_c8695d58ee484fb49ebe79762d806d00/4c83ff1ae5a0ce2144a9a8f4ea877fc8ccb95882.svg
:target: https://badge.fury.io/py/raffaello
.. |Build Status| image:: vertopal_c8695d58ee484fb49ebe79762d806d00/6a7e16d9fbe5b315f689672a9e5b02a94834961a.svg
:target: https://travis-ci.org/clobrano/raffaello
.. |Donate| image:: vertopal_c8695d58ee484fb49ebe79762d806d00/8342c8fb5c2918722afdcda84b3d4527dc79f7ca.svg
:target: https://www.paypal.me/clobrano/5
Raw data
{
"_id": null,
"home_page": "https://github.com/clobrano/raffaello",
"name": "raffaello",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "formatter,console,colorizer",
"author": "Carlo Lobrano",
"author_email": "c.lobrano@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/c4/40/7bb5764767ba9692f4728e1cfba4e94ee643b3bd3307ed2a3fa5e864d526/raffaello-4.0.1.tar.gz",
"platform": null,
"description": "Raffaello - output colorizer\n============================\n\nRaffaello colorizes the output stream of any command-line tool\n(e.g.\u00a0gcc/g++, cmake, dmesg, syslog and custom), making it easier to\nread.\n\nUsage\n-----\n\nThe raffaello\u2019s command line interface let you use two call modes:\n**pipes** and **command**.\n\nIn pipe mode you call raffaello like:\n\n::\n\n <output stream source> | raffaello [options]\n\nIn command mode raffaello will call your stream source in your behalf\n\n::\n\n raffaello [options] -c <output stream source>\n\nTo highlight the output stream, Raffaello has **2 color modes** and **2\nstyles modes**:\n\nColor modes:\n\n- **8 colors** mode let you use the following names: *black, red,\n green, yellow, blue, magenta, cyan, light_gray*. **NEW** Starting\n from version 3.0.3 Raffaello introduces a *blind* color: *lines\n matching the pattern with color \u201cblind\u201d will be REMOVED from the\n stream*. This will improve readability of dense stream output.\n\n- **256 colors** mode let you use other 248 colors and choose between\n foreground or background colors (you can mix 8 colors mode names with\n 256 color mode names):\n\nColor styles:\n\n- Foreground color names are in the form ``colorNUM``. E.g. foreground\n red is *color001*\n- Background color names are in the form ``bgcolorNUM``. E.g.\n background red is *bgcolor001*\n\nWith the styles you can blend colors in **bold** and **underlined**\n\n- foreground red bold is *color001_bold*\n- foreground red underlined is *color001_underlined*\n\nCall ``raffaello -l`` to see the complete list of available colors.\n\nFull interface description\n~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n::\n\n Usage: raffaello (-p PRESET | -r REQUEST | -f FILE | -l) [options]\n\n -p PRESET, --preset=PRESET Prebuilt config files for coloring known output streams (gcc/g++, cmake, dmesg, gcc/g++, ModemManager, logcat...)\n -r REQUEST --request=REQUEST The requested text/color mapping string. Multipe requests are separated by a space. Regular expression are supported. E.g. \"error=>red [Ww]arning=>yellow_bold\".\n -f FILE --file=FILE Path to the custom text=>color configuration file.\n -c COMMAND --command=COMMAND Instead of using raffaello with pipes, set the command-line tool to be executed by raffaello directly. E.g. -c \"dmesg -w\".\n -m, --match-only Print only the lines that match against some defined pattern.\n -d DELIMITER --delimiter=DELIMITER If you don't like \"=>\" as delimiter between text and color, use this flag to change it. E.g. -d & [default: =>]\n -l, --list List all the available colors and presets\n -v --verbose Enable debug logging\n\n**NEWS** - version 3.0.3 \u2013match-only flag Print only the lines that\nmatch against any defined pattern.\n\nExamples\n--------\n\nThe simpler usage is using the ``request`` flag. The ``request`` flag\nrequires a string in the form \u201ctext=>color anothertext=>anothercolor\u201d,\nwhere text can be a constant string or a `Regular\nexpression <https://docs.python.org/2/library/re.html>`__, while color\nis the name of the color to use (see `Usage <#Usage>`__ section)\n\n- Simple constant text highlight\n\n ::\n\n $ ifconfig eno1 | raffaello --request=\"collisions=>blue\"\n\nexample001\n\n- Highlight of multiple texts. Here you can see that spaces in the\n \u201ctext part\u201d are not allowed. Use :raw-latex:`\\s `instead.\n\n ::\n\n $ ifconfig eno1 | raffaello --request=\"RX\\spackets=>green TX\\spackets=>red\"\n\nexample002\n\n- Highlight with regular expressions\n\n ::\n\n $ ifconfig eno1 | raffaello --request=\"\\d+\\.\\d+\\.\\d+\\.\\d+=>green_bold\"\n\nexample003\n\nFor more complex color mapping you can write a file with a line for each\n*text=>color* entry, like the following\n\n::\n\n collisions=>blue\n RX\\spackets=>green\n TX\\spackets=>red\n \\d+\\.\\d+\\.\\d+\\.\\d+=>green_bold\n\nsave the file and provide it to raffaello using its fullpath\n\n::\n\n $ ifconfig eno1 | raffaello --file=$HOME/colorfile\n\nexample004\n\nColor files can be reused in other color files using the ``include``\ndirective followed by the fullpath to the file.\n\nUsing fullpath is annoying, tough, so Raffaello has a special path under\n$HOME/.raffaello. All the colorfiles inside this folder can be passed\nusing simply their filename, without the path.\n\n::\n\n # include custom colorfile in $HOME/.raffaello\n include some_custom_colorfile\n\n # include custom color outside $HOME/.raffaello\n include $HOME/path/to/some_other_custom_color\n\n collisions=>blue\n RX\\spackets=>green\n TX\\spackets=>red\n \\d+\\.\\d+\\.\\d+\\.\\d+=>green_bold\n\nRaffaello provides some built-in colorfiles, called **presets**, for\nknown tools like cmake, gcc/g++, dmesg, etc. The presets can be used\nalone using ``--preset`` flag or even included in custom colorfile in\norder to extend their colormaps.\n\n::\n\n # Include a preset colorfile\n include errors\n\n # include custom colorfile in $HOME/.raffaello\n include some_custom_colorfile\n\n # include custom color outside $HOME/.raffaello\n include $HOME/path/to/some_other_custom_color\n\n collisions=>blue\n RX\\spackets=>green\n TX\\spackets=>red\n \\d+\\.\\d+\\.\\d+\\.\\d+=>green_bold\n\nFor a full list of presets, call ``raffaello --list``.\n\nRaffaello is a python module\n----------------------------\n\nRaffaello can be used as a python module inside other source codes\n\n.. code:: python\n\n from raffaello import Raffaello, Commission\n\n request = '''\n error=>red\n warning=>yellow_bold\n bluish\\stext=>color026\n '''\n\n c = Commission(request)\n r = Raffaello(c.commission)\n\n print(r.paint('Sample message with error, warning and a bluish text.'))\n\nInstall\n-------\n\nInstall from source using setuptools. Just type the following command\n\n::\n\n # python setup.py install\n\nInstall from `PyPI - the Python Package\nIndex <https://pypi.python.org/pypi>`__\n\n::\n\n # pip install raffaello\n\nDependencies\n------------\n\n- ``docopt`` language for description of command-line interfaces\n\n.. |PyPI version| image:: vertopal_c8695d58ee484fb49ebe79762d806d00/4c83ff1ae5a0ce2144a9a8f4ea877fc8ccb95882.svg\n :target: https://badge.fury.io/py/raffaello\n.. |Build Status| image:: vertopal_c8695d58ee484fb49ebe79762d806d00/6a7e16d9fbe5b315f689672a9e5b02a94834961a.svg\n :target: https://travis-ci.org/clobrano/raffaello\n.. |Donate| image:: vertopal_c8695d58ee484fb49ebe79762d806d00/8342c8fb5c2918722afdcda84b3d4527dc79f7ca.svg\n :target: https://www.paypal.me/clobrano/5\n\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Raffaello command-line output colorizer",
"version": "4.0.1",
"split_keywords": [
"formatter",
"console",
"colorizer"
],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "b897651e969e4ab4aa8799068dbaa1f5",
"sha256": "7da41196e1a8789725c489e9ee7392d106a021abe2a06dfbb3feccc07817dbea"
},
"downloads": -1,
"filename": "raffaello-4.0.1.tar.gz",
"has_sig": false,
"md5_digest": "b897651e969e4ab4aa8799068dbaa1f5",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 14026,
"upload_time": "2022-12-05T10:00:42",
"upload_time_iso_8601": "2022-12-05T10:00:42.587886Z",
"url": "https://files.pythonhosted.org/packages/c4/40/7bb5764767ba9692f4728e1cfba4e94ee643b3bd3307ed2a3fa5e864d526/raffaello-4.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-12-05 10:00:42",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "clobrano",
"github_project": "raffaello",
"travis_ci": true,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "raffaello"
}