Metadata-Version: 2.1
Name: linecook
Version: 0.4.0
Summary: Prepare lines of text for easy consumption
Home-page: https://github.com/tonysyu/linecook
License: BSD-3-Clause
Keywords: console,terminal,logging,parsing,color
Author: Tony S. Yu
Author-email: tsyu80@gmail.com
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Topic :: Software Development
Requires-Dist: future (>=0.15,<0.16)
Requires-Dist: termcolor (>=1.0.0,<2.0.0)
Requires-Dist: toolz (>=0.9.0,<0.10.0)
Project-URL: Documentation, https://linecook.readthedocs.io/
Project-URL: Repository, https://github.com/tonysyu/linecook
Description-Content-Type: text/x-rst

====================================================
linecook: Prepare lines of text for easy consumption
====================================================

.. default-role:: literal

.. image:: https://img.shields.io/badge/License-BSD%203--Clause-blue.svg
   :target: https://github.com/tonysyu/linecook/blob/master/LICENSE

.. image:: https://travis-ci.com/tonysyu/linecook.svg?branch=master
   :target: https://travis-ci.com/tonysyu/linecook

.. image:: https://codecov.io/gh/tonysyu/linecook/branch/master/graph/badge.svg
   :target: https://codecov.io/gh/tonysyu/linecook

.. image:: https://readthedocs.org/projects/linecook/badge/
   :target: https://linecook.readthedocs.io

`linecook` is a command-line tool that transforms lines of text into a form
that's pleasant to consume.

- **Documentation:** https://linecook.readthedocs.io
- **Source:** https://github.com/tonysyu/linecook

Install
=======

The recommended way of installing `linecook` is to use `pip`::

    pip install linecook

Cooking up some beautiful text
==============================

The core goal of `linecook` is to make it easy to create your own transforms to
parse whatever text you have. For example, take an `app.log` file that looks
like:

.. image:: docs/_static/images/app_log_raw.png

If you want to highlight the log type and mute the dates/times, then you can
create a custom recipe in one of your `configuration files
<https://linecook.readthedocs.io/en/latest/configuration.html>`_ like the
following:

.. code-block:: python

   from linecook import patterns as rx
   from linecook.transforms import color_text

   LINECOOK_CONFIG = {
       'recipes': {
           'my-logs': [
                color_text(rx.any_of(rx.date, rx.time), color='blue'),
                color_text('INFO', color='cyan'),
                color_text('WARN', color='grey', on_color='on_yellow'),
                color_text('ERROR', on_color='on_red'),
           ],
       },
   }

To use this recipe, you can just pipe the log output to `linecook` with your
new recipe as an argument:

.. image:: docs/_static/images/app_log_linecook.png

That's all there is to it!

See Also
========

- `grc <https://github.com/garabik/grc>`_: A generic colouriser (sic;) for log
  files and command output.
- `rainbow <https://github.com/nicoulaj/rainbow>`_: Colorize commands output or
  STDIN using patterns.
- `multitail <https://www.vanheusden.com/multitail/>`_: Tail multiple files at
  once, with features to colorize, filter, and merge.
- `colortail <https://github.com/joakim666/colortail>`_: Like the tail command
  line utility but with colors
- `StackOverflow post on colored output
  <https://unix.stackexchange.com/questions/8414>`_

