colorexp

command module
v1.0.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 15, 2024 License: GPL-3.0 Imports: 5 Imported by: 0

README

Colorexp

Colorexp is a command line tool that allows coloring of text matches from standard input with multiple colors, something that is not easy to achieve with tools like grep and less.

Colorexp

  • uses the Go regexp format, as documented here.
  • supports overlapping matches (the color for the last pattern that matches will be used)

Usage

Usage: colorexp [options] patterns...
  -F, --fixed-strings           Do not interpret regular expression metacharacters.
  -h, --no-highlight            Do not color by changing the background color.
  -H, --only-highlight          Only color by changing the background color.
  -i, --ignore-case             Perform case insensitive matching.
  -g, --vary-group-colors-off   Turn off changing of colors for every capturing group. Defaults to on if exactly one pattern is given.
  -G, --vary-group-colors-on    Turn on changing of colors for every capturing group. Defaults to on if exactly one pattern is given.

Examples

Basic Usage
  • use the -h/-H options to only colorize the text, or only the background

Example

Overlapping matches - last match wins
  • all matches are colorized, and the color of the last match will be used

Example

Capturing groups
  • when using capturing groups, only the matched group contents will be colorized
Vary colors of groups in patterns
  • when exactly one pattern is given, the default is to use different colors for each capturing group
    • in case of multiple patterns, the -G option can be used to enforce varying of the colors for each group

Example

Use the same color for all groups of a pattern
  • when multiple patterns are given, the default is to use the same colors for all capturing groups of a pattern
    • in case of a single pattern, the -g option can be used to enforce use of a single color

Example

Installation

Homebrew on MacOS

brew tap EugenDueck/tap https://github.com/EugenDueck/homebrew-tap
brew install colorexp

All OSes

Build

go build colorexp.go

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL