Skip to main content

A super easy console highlighter. Text goes in, color comes out.

Project description

A super easy console highlighter. Text goes in, color comes out. rad can be used to process the output of commands, or to highlight single files.

How it works

rad will read the file given with --file/-f, or stdin if omitted.

Highlighting is specified with re-usable colorer files. Colorer files are written in YAML. They contain a collection of rules like this:

"regex":
    fore: green
    back: black
    style: normal

or this:

regex: {fore: red, back: white, style: bright}

and are stored in ~/.rad/ by default. The simplest way to use rad is to give it the names of one or more colorers, like so:

$ echo "this is a test" | rad colorer1 colorer2

and all rules in the colorers ~/.rad/colorer1.yaml and ~/.rad/colorer2.yaml will be applied to the input text in order!

rad can also make these files for you interactively, using the --new/-n option:

$ rad -n
Colorer name for this rule: logs
Pattern to match: ERROR
Foreground color [white]: red
Background color [black]:
Style [bright]:

$ tail -f log.txt | rad logs

Colorer files will be appended to, so you can quickly build a colorer with a bunch of rules by running this a few times.

Roadmap

I plan on supporting the following in future releases of rad, while trying to keep the usage and syntax super-simple at the same time:

  • Multi-line highlighting, using start and stop regexes (e.g. highlight between HTML script tags or in tracebacks)

  • Support for syntax highlighting using Pygments by giving a lexer/formatter for a multi-line rule

  • Support for 256 colors (using Fabulous…?)

  • Other awesome stuff depending on how people want to use it

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rad-0.1.1.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

rad-0.1.1-py2.6.egg (10.1 kB view details)

Uploaded Source

File details

Details for the file rad-0.1.1.tar.gz.

File metadata

  • Download URL: rad-0.1.1.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for rad-0.1.1.tar.gz
Algorithm Hash digest
SHA256 d4a15faafd19016a4e9f3b87186fc156985839fe083b075ee80b37b962294e05
MD5 099693bc231be693d28c8ecd16fbd8e2
BLAKE2b-256 25a0662b6d49d7611daec0c7a3b2d489dbcd0c4a30fedd462bc7e23c30971de0

See more details on using hashes here.

Provenance

File details

Details for the file rad-0.1.1-py2.6.egg.

File metadata

  • Download URL: rad-0.1.1-py2.6.egg
  • Upload date:
  • Size: 10.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for rad-0.1.1-py2.6.egg
Algorithm Hash digest
SHA256 99733a8e880c2f4204df3066fe750fc6619be3a9b3ce129bb4ed5ce898dcf312
MD5 0398b825cfc3b2a605bdaab7e94af2c5
BLAKE2b-256 b2cb6a060befc6c78a8328c903bf7ca78eda912f52f68222c1a42cf9ed8ac5fa

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page