Giter Site home page Giter Site logo

colorexp's Introduction

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, --full-match-highlight    Highlight the entire match, even if pattern contains capturing groups.
  -F, --fixed-strings           Do not interpret regular expression metacharacters.
  -i, --ignore-case             Perform case insensitive matching.
  -h, --no-highlight            Do not color by changing the background color.
  -H, --only-highlight          Only color by changing the background color.
  -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

colorexp's People

Contributors

eugendueck avatar

Stargazers

Will Morrison avatar Michael Lorant avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.