Skip to content
Grep with colours
Go Other
  1. Go 99.0%
  2. Other 1.0%
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github/ISSUE_TEMPLATE Update issue templates Jun 14, 2018
blush
cmd
configs
internal remove /dev/stdin from printing when restuls are piped Jun 14, 2018
.gitignore
.travis.yml support go 1.7 by removing SliceStable (closes #6) Jun 13, 2018
CHANGELOG.md
CODE_OF_CONDUCT.md
CONTRIBUTING.md
LICENSE
Makefile
PULL_REQUEST_TEMPLATE.md Create PULL_REQUEST_TEMPLATE.md Jun 14, 2018
README.md support go 1.7 by removing SliceStable (closes #6) Jun 13, 2018
doc.go
glide.lock
glide.yaml bugfix: update glide for monkey library. Jun 6, 2018
main.go

README.md

Blush

License: MIT GoDoc Build Status Coverage Status Go Report Card Codacy Badge

With Blush, you can grep with any colours of your choice.

Colored

  1. Install
  2. Usage
  3. Arguments
  4. Colour Groups
  5. Colours
  6. Complex Grep
  7. Suggestions
  8. License

Install

You can grab a binary from releases page. If you prefer to install it manually you can get the code and install it with the following command:

$ go get github.com/arsham/blush

Make sure you have go>=1.7 installed.

Update

In order to update the program:

$ cd $GOPATH/src/github.com/arsham/blush
$ make update
$ make install

Usage

Match Method

This method shows matches with the given input:

$ blush -b "first search" -g "second one" -g "and another one" files/paths

Any occurrence of first search will be in blue, second one and and another one are in green.

Colored

Colouring Method

With this method all texts are shown, but the matching words are coloured. You can activate this mode by providing --colour or -C argument.

Colored

Piping

Blush can also read from a pipe:

$ cat FILENAME | blush -b "print in blue" -g "in green" -g "another green"
$ cat FILENAME | blush "some text"

Arguments

+---------------+----------+------------------------------------------------+
|    Argument   | Shortcut |                     Notes                      |
+---------------+----------+------------------------------------------------+
| --colour      | -C       | Colour, don't drop anything.                   |
| N/A           | -i       | Case insensitive matching.                     |
| N/A           | -R       | Recursive matching.                            |
| --no-colour   | N/A      | Don't colourize matches.                       |
| --no-color    | N/A      | Same as --no-colour.                           |
| --no-filename | -h       | Suppress the prefixing of file names on output.|
+---------------+----------+------------------------------------------------+

File names or paths are matched from the end. Any argument that doesn't match any files or paths are considered as regular expression. If regular expressions are not followed by colouring arguments are coloured based on previously provided colour:

$ blush -b match1 match2 FILENAME

Colored

Notes

  • If no colour is provided, blush will choose blue.
  • If you only provide file/path, it will print them out without colouring.
  • If the matcher contains only alphabets and numbers, a non-regular expression is applied to search.

Colour Groups

You can provide a number for a colour argument to create a colour group:

$ blush -r1 match1 -r2 match2 -r1 match3 FILENAME

Colored

All matches will be shown as blue. But match1 and match3 will have a different background colour than match2. This means the numbers will create colour groups.

You also can provide a colour with a series of match requests:

$ blush -r match1 match3 -g match2 FILENAME

Colours

You can choose a pre-defined colour, or pass it your own colour with a hash:

+-----------+----------+
|  Argument | Shortcut |
+-----------+----------+
| --red     | -r       |
| --green   | -g       |
| --blue    | -b       |
| --white   | -w       |
| --black   | -bl      |
| --yellow  | -yl      |
| --magenta | -mg      |
| --cyan    | -cy      |
+-----------+----------+

You can also pass an RGB colour. It can be in short form (--#1b2, -#1b2), or long format (--#11bb22, -#11bb22).

Colored

Complex Grep

You must put your complex grep into quotations:

$ blush -b "^age: [0-9]+" FILENAME

Colored

Suggestions

This tool is made to make your experience in terminal a more pleasant. Please feel free to make any suggestions or request features by creating an issue.

Please see changelog document for newest changes.

License

Use of this source code is governed by the MIT License. License file can be found in the LICENSE file.

You can’t perform that action at this time.