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.2.0.tar.gz
.
File metadata
- Download URL: linecook-0.2.0.tar.gz
- Upload date:
- Size: 13.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 747b11217f7de46d40bae5f16dd21ca9f5fe905cff6e77936409b920c479d0fa |
|
MD5 | cff9eeee1f03a5f41c467918376eda44 |
|
BLAKE2b-256 | 9fd9a5bd3499d5513e20965933998794df78fef841884852cd0ff2ec1a2c54b6 |
File details
Details for the file linecook-0.2.0-py2.py3-none-any.whl
.
File metadata
- Download URL: linecook-0.2.0-py2.py3-none-any.whl
- Upload date:
- Size: 18.1 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 174ebf8912c7dfbde78016720b9e91b5254c85afc8fb408da8dedb0765e690ae |
|
MD5 | f429fa080eabd4a613fa8a63fbc1fe34 |
|
BLAKE2b-256 | ab27ca3bb788909b3a5b2392e202e592c2e6bd27691d114ea2ac5406f5c1d302 |