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.2.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Source

File details

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

File metadata

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

File hashes

Hashes for rad-0.1.2.tar.gz
Algorithm Hash digest
SHA256 21aea84c55479b7b4987aac5b85f4917b3228720c5cfeada44c184515f9a6f47
MD5 131438434fd27efbcac9d01427d01e78
BLAKE2b-256 2209fd32b9ffac80e0de7fb4db8d493e93905a64b00cd050a33883e519d29aad

See more details on using hashes here.

Provenance

File details

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

File metadata

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

File hashes

Hashes for rad-0.1.2-py2.6.egg
Algorithm Hash digest
SHA256 8f059611bf3543a0cef7fd24a99ed93bbd18e7ac470b932de28041440896c6dd
MD5 648353038e261d5840891a18efb29849
BLAKE2b-256 6eb148279c7c33e7ecb4cddbfee336d83f3696257c89e58c0db44d0867829dd3

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