Prepare lines of text for easy consumption
Project description
linecook is a command-line tool that transforms lines of text into a form that’s pleasant to consume.
Documentation: https://linecook.readthedocs.io
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:
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 like the following:
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:
That’s all there is to it!
See Also
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file linecook-0.4.0.tar.gz
.
File metadata
- Download URL: linecook-0.4.0.tar.gz
- Upload date:
- Size: 14.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/0.12.16 CPython/3.6.8 Darwin/18.5.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e689c01e03f3d7ee539f16bf477e087c9d390abcf4cbd3360e92998f718e79b7 |
|
MD5 | c5d7ffa0e28009995e1b0be02151be3b |
|
BLAKE2b-256 | 4737ec5d16a6a51fd9beef9b113e65141f7ca63105fcf518d317a48a19dc0a31 |
File details
Details for the file linecook-0.4.0-py2.py3-none-any.whl
.
File metadata
- Download URL: linecook-0.4.0-py2.py3-none-any.whl
- Upload date:
- Size: 18.9 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/0.12.16 CPython/3.6.8 Darwin/18.5.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dde115d4e10451abf5a3e9449b7bd5abbc5afc34ab943817151c51ddaa5911d5 |
|
MD5 | 8f04a9a3c7db51840fb96ed0651f5c29 |
|
BLAKE2b-256 | 460e964f5cf67d63b90ff875262a77d8da95c45f940feca727ddcb5093185fd1 |