- Notifications
You must be signed in to change notification settings - Fork18
arsham/blush
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
With Blush, you can highlight matches with any colours of your choice.
You can grab a binary fromreleasespage. If you prefer to install it manually you can get the code and install itwith the following command:
$ go install github.com/arsham/blush@latest
Make sure you havego>=1.18
installed.
Blush can read from a file or a pipe:
$ cat FILENAME| blush -b"print in blue" -g"in green" -g"another green"$ cat FILENAME| blush"some text"$ blush -b"print in blue" -g"in green" -g"another green" FILENAME$ blush"some text" FILENAME
Although this program has a good performance, but performance is not the mainconcern. There are other tools you should use if you are searching in largefiles. Two examples:
This method shows matches with the given input:
$ blush -b"first search" -g"second one" -g"and another one" files/paths
Any occurrence offirst search
will be in blue,second one
andand another one
are in green.
By default, unmatched lines are not dropped. But you can use the-d
flag todrop them:
Argument | Shortcut | Notes |
---|---|---|
N/A | -i | Case insensitive matching. |
N/A | -R | Recursive matching. |
--no-filename | -h | Suppress the prefixing of file names on output. |
--drop | -d | Drop unmatched lines |
File names or paths are matched from the end. Any argument that doesn't matchany files or paths are considered as regular expression. If regular expressionsare not followed by colouring arguments are coloured based on previouslyprovided colour:
$ blush -b match1 match2 FILENAME
- 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.
You can provide a number for a colour argument to create a colour group:
$ blush -r1 match1 -r2 match2 -r1 match3 FILENAME
All matches will be shown as blue. Butmatch1
andmatch3
will have adifferent background colour thanmatch2
. This means the numbers will createcolour groups.
You also can provide a colour with a series of match requests:
$ blush -r match1 match3 -g match2 FILENAME
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), orlong format (--#11bb22, -#11bb22).
You must put your complex grep into quotations:
$ blush -b"^age: [0-9]+" FILENAME
This tool is made to make your experience in terminal a more pleasant. Pleasefeel free to make any suggestions or request features by creating an issue.
Use of this source code is governed by the MIT License. License file can befound in theLICENSE file.
About
Grep with colours