highlight

Tool/Lib to highlight text in CLI by using regular expressions.


Keywords
cli, tool, highlighting, colorizing
License
MIT
Install
nimble install highlight

Documentation

Nim Highligter

nimble

Introduction

Provides a tool and a library to colorize the output of cli-tools. This project is inspired by the ruby-gem colorize (https://github.com/fazibear/colorize).

Get Started

Install Nim Highlighter

$ nimble install nimhighlight

Using cli-tool hightlight:

# Show help ...
$ highlight --help

# Colorize Std-Input ...
$ echo "hello dude world" | highlight -e=".+:blue" -e=ello:green -e="l:red" -e=worl:magenta:yellow

# Example: Highlight keywords in source-file ...
$ cat src/highlight.nim | dist/release/highlight -e="^.+:black" -e="while|true|false|when|type|case:yellow" -e="#.+:green" -n

# Create and use config file ...
$ highlight --init -e=".+:blue" -e=ello:green -e="l:red" -e=worl:magenta:yellow
$ echo "hello dude world" | highlight

Using Nim Highlighter as library

import highlightpkg/colorize

echo "Hello World".green
echo "Hello World".onYellow
echo "Hello World".yellow.onBlue

Develop

Running Tests

$ nimble test

Links