Compare commits

...

141 Commits

Author SHA1 Message Date
Radovan Garabík f4a579e08d new minor debian release 2021-08-22 13:38:08 +02:00
Radovan Garabík c81ae202b1 fix ip addr broadcast colouring 2021-08-22 13:35:37 +02:00
Radovan Garabík f79a3dc650 source only Debian upload 2021-08-20 16:41:12 +02:00
Radovan Garabík 47e7daa155 update changelog date 2021-08-07 17:44:43 +02:00
Radovan Garabík 223732e54b comment upon GRC_ALIASES=true 2021-08-07 17:37:34 +02:00
Radovan Garabík ab22533a16 add documentation about automatic aliasing 2021-08-07 16:30:46 +02:00
Radovan Garabík ea4aa18200 typo 2021-07-26 18:16:33 +02:00
Radovan Garabík 6f0a553c76 env is too invasive to alias 2021-07-26 18:15:22 +02:00
Radovan Garabík d8fc493d72 preparing new release 2021-07-26 18:11:58 +02:00
Radovan Garabík 09793f88a6 on python 2 & 3 compatibility 2021-07-26 18:04:13 +02:00
Radovan Garabík e277b6e960 do not exit from the main shell when sourcing 2021-07-26 18:02:08 +02:00
Radovan Garabík 1d7de7ea44 Merge branch 'devel' of github.com:garabik/grc into devel 2021-07-06 20:28:50 +02:00
Radovan Garabík cffdc86127 update debian build 2021-07-06 20:27:08 +02:00
Radovan Garabík 30ecf4688f add debian /etc/default 2021-07-06 20:10:33 +02:00
Radovan Garabík db55a51206 clean debian/rules a bit 2021-07-06 20:10:15 +02:00
Radovan Garabík 64c1ba6a0d alias only in terminal 2021-07-06 17:37:37 +02:00
Radovan Garabík 9dd0d18f62 cleanup 2021-07-06 12:47:14 +02:00
Radovan Garabík c367041dcc
Merge pull request #184 from feriman/fix-ipv6-parsing
IPv6 address consists of hexadecimal digits, so "\d" is unsuitable here.
2021-07-05 16:58:08 +02:00
Radovan Garabík 4ea874b224
Merge pull request #179 from joeky888/free
conf.free: support inhuman free
2021-07-05 16:45:56 +02:00
Vitaliy Perekhovy ae9cecb66c IPv6 address conists of hexadecimal digits, so "\d" is unsuitable here. 2021-06-11 14:51:07 +03:00
Joeky b7e96762b4 conf.free: support inhuman free
Signed-off-by: Joeky <joeky5888@gmail.com>
2021-04-20 23:16:19 +08:00
Radovan Garabík 06afa277e0 keep grc.sh profile 2021-03-01 10:26:14 +01:00
Radovan Garabík e0c5ab25c8 add acute 2021-03-01 10:10:55 +01:00
Radovan Garabík ca8acefed8 update debian changelog 2021-03-01 09:52:43 +01:00
Radovan Garabík cb0ee756ca bump version 2021-03-01 09:40:59 +01:00
Radovan Garabík acd749e705 restore _grc 2021-01-01 21:35:53 +01:00
Radovan Garabík 7cd8fff5e1 moved log and irclog last 2020-12-29 16:42:59 +01:00
Radovan Garabík 357e686aa6
Merge pull request #173 from hjpotter92/update/aliases
Changes as per review.
2020-12-29 16:16:18 +01:00
Radovan Garabík 2fc38520fc dummy configuration file 2020-12-29 16:14:33 +01:00
Radovan Garabík 1844de085c do not crash on invalid utf-8 2020-12-29 16:13:59 +01:00
Radovan Garabík 4e796fbb8d rm cruft 2020-12-29 16:11:54 +01:00
hjpotter92 7eaacb5c4a Changes as per review.
98f483068a (r45477503)

Signed-off-by: hjpotter92 <hjpotter92+github@gmail.com>
2020-12-29 03:26:19 +05:30
Radovan Garabík a31019fd81 Merge branch 'devel' of github.com:garabik/grc into devel 2020-12-28 17:07:40 +01:00
Radovan Garabík 98f483068a
Merge pull request #172 from hjpotter92/update/aliases
Add completions for aliases when defined for zsh.
2020-12-28 17:07:30 +01:00
Radovan Garabík f2ace18191 change grc.bashrc to grc.sh, as /etc/profile.d/ works only with .sh extensions 2020-12-28 17:01:17 +01:00
Radovan Garabík 61c070db25
Merge pull request #170 from Raizo62/p_log_ip_port
conf.log : the port of "172.16.1.100:56364" is now fully colored
2020-12-28 16:51:01 +01:00
Radovan Garabík ce4f6290d8
Merge pull request #168 from Raizo62/p_conf.log
conf.log : accept now empty string "" and empty parentheses ()
2020-12-28 16:49:50 +01:00
Radovan Garabík eaf4203de1 fix configure command matching 2020-12-28 16:47:45 +01:00
Radovan Garabík 8f7adc0eee fix ldap command matching 2020-12-28 16:45:59 +01:00
Radovan Garabík e969eeef72 fix du command matching 2020-12-28 16:44:53 +01:00
Radovan Garabík 826422fad6 cli regexp matched too much 2020-12-28 16:40:12 +01:00
hjpotter92 757515996f Add curl and ulimit to colourisable commands.
Signed-off-by: hjpotter92 <hjpotter92+github@gmail.com>
2020-12-28 20:45:20 +05:30
hjpotter92 8eb0e6614b Cleaner if-statement
Signed-off-by: hjpotter92 <hjpotter92+github@gmail.com>
2020-12-28 20:31:41 +05:30
hjpotter92 8275543560 Add completions for aliases when defined for zsh.
More description available on github thread:
https://github.com/ohmyzsh/ohmyzsh/issues/6954

Signed-off-by: hjpotter92 <hjpotter92+github@gmail.com>
2020-12-28 20:29:22 +05:30
Raizo62 4cdaaceb3e conf.log : the port of "172.16.1.100:56364" is now fully colored 2020-12-12 12:50:25 +01:00
Raizo62 ec1eab4f64 conf.log : accept now empty string "" and empty parentheses () 2020-12-06 12:05:32 +01:00
Radovan Garabík 70f4178f37
Merge pull request #164 from junkdog/patch-1
docker ps: ip addresses and ports colorization
2020-11-26 10:21:49 +01:00
Adrian Papari 5ee2461214
Update conf.dockerps 2020-11-24 23:39:52 +01:00
Adrian Papari 5fefb0602f
fix ip addresses and ports colorization 2020-11-24 23:34:41 +01:00
Radovan Garabík 8f5b15e55a tweak license to be not incompatible with GPL 2020-11-24 17:00:13 +01:00
Radovan Garabík b16ae2647d clean up zsh syntax 2020-11-18 16:44:59 +01:00
Radovan Garabík 371f85a580 fix command boundary 2020-11-13 13:27:05 +01:00
Radovan Garabík 9f61e86374 Merge branch 'devel' of github.com:garabik/grc into devel 2020-11-13 13:26:45 +01:00
Radovan Garabík f7b36ed2c0 fix command boundaries 2020-11-13 13:26:41 +01:00
Radovan Garabík 7704a1824e
Merge pull request #163 from grassharper/devel
add support for FreeBSD's sockstat command
2020-11-13 13:26:03 +01:00
Andrei Buzoianu 4e1e9d7fdc
add sockstat alias 2020-10-13 17:15:57 +03:00
Andrei Buzoianu dfb89f2e15
add sockstat alias 2020-10-13 17:15:27 +03:00
Andrei Buzoianu 95da0c8e3a
add regular expression for sockstat 2020-10-13 17:13:36 +03:00
Andrei Buzoianu 3f3fc2932e
update grc.bash to add sockstat alias 2020-10-13 17:08:49 +03:00
Andrei Buzoianu 499fdbff0e
add sockstat colors config file 2020-10-13 17:06:20 +03:00
Radovan Garabík 8263f4f63b
Merge pull request #156 from wwalker/155
Support for FQDNs, and add the journalctl alias to the grc.bash and grc.fish
2020-07-19 13:56:43 +02:00
Radovan Garabík 8c2a0ace74
Merge pull request #131 from Raizo62/devel
grc.conf : command ip and traceroute :
2020-07-19 13:53:49 +02:00
Radovan Garabík e5f43bf3d8 add aliases to zsh 2020-07-01 17:50:04 +02:00
Radovan Garabík 892c6f6671
Merge pull request #154 from jnovack/patch-7
Create conf.curl
2020-07-01 17:32:41 +02:00
Radovan Garabík 023c88b37b
Merge pull request #153 from jnovack/patch-6
Add support for `go test`
2020-07-01 17:31:35 +02:00
Radovan Garabík fb14b1a0a0
Merge pull request #151 from jnovack/patch-1
Update conf.dockerps
2020-07-01 17:30:37 +02:00
Wayne Walker 0c615d2904 Support for FQDNs, and add the journalctl alias to the grc.bash and grc.zsh 2020-06-27 13:47:03 -05:00
Justin J. Novack f2ec76166e
Create conf.curl 2020-06-10 09:54:56 -04:00
Justin J. Novack 92e48627f8
Create conf.go-test 2020-06-10 08:15:43 -04:00
Justin J. Novack a51b7f0a7b
Update grc.conf
Fixes #122.

Add go-test colorization.
2020-06-10 08:14:30 -04:00
Justin J. Novack 448f19652a
Update conf.dockerps
Correct statuses to call out starting and unhealthy containers
2020-06-09 17:48:11 -04:00
Radovan Garabík 01a21de7fa
Merge pull request #150 from rpolishchuk/rp-fix-135
Change configuration order to sytem-then-user
2020-06-02 21:25:18 +02:00
Radovan Garabík 7d04c05cd0 fix df 2020-06-02 21:12:13 +02:00
Radovan Garabík 3101bb9eb3
Merge pull request #145 from darkain/patch-df
Fixing/extending df command
2020-06-02 20:34:17 +02:00
Rostyslav Polishchuk fba1ba22b5
Change configuration order to sytem-then-user
If the user creates a user-specific configuration the system-wide
configuration stops working.

This PR changes the order to system-then-user.
The latest found takes precedence.
2020-05-29 18:28:40 -07:00
Radovan Garabík c910742ee6
Merge pull request #143 from darkain/patch-2
interfaces can have dots in their names
2020-05-24 20:05:26 +02:00
Radovan Garabík 23c1802b4a
Merge pull request #140 from darkain/patch-1
Fixing du colorization
2020-05-24 19:59:14 +02:00
Raizo62 6006304f28 conf.traceroute : - replace \b by \s (see the example below)
- good regular expression for warning messages (letters from : https://linux.die.net/man/8/traceroute)
	- remove the example with the command mail (which report with traceroute ?)

traceroute to 30.0.0.4 (30.0.0.4), 30 hops max, 60 byte packets
 1  10.0.0.2 (10.0.0.2)  0.648 ms  0.479 ms  0.426 ms
 2  23.0.0.3 (23.0.0.3)  1.983 ms  2.402 ms  2.509 ms
 3  23.0.0.3 (23.0.0.3)  3058.805 ms !H  3059.171 ms !H  3058.985 ms !H
2020-03-08 10:51:19 +01:00
Vincent Milum Jr f6788db3e1
Fixing/extending df command
Fixing some percentages not detecting properly.
Extending support so "df" has colors just like "df -h"
2020-02-03 13:53:44 -08:00
Vincent Milum Jr 0a8a163c03
interfaces can have dots in their names 2020-01-29 05:47:28 +00:00
Vincent Milum Jr 43092396e8
Fixing du colorization
1) du without -h is now supported.
2) du -h can output a 2-digit file size, eg " 25MB", and will have a space character for padding, and this is now accounted for.
2020-01-08 14:02:08 -08:00
Raizo62 1a8a777ee0 grc.conf : command ip :
- accept parameters between "ip" and main parameter
	- accept all correct syntax of "address" ("a", "ad", "add", "addr", "addre",...,"address")
	- do the the same with "link", "route" and "neighbour"
2019-09-14 10:50:55 +02:00
Radovan Garabík 30606591b7
Merge pull request #129 from luisdavim/patch-3
fixes conflicts with some kubectl commands
2019-08-25 13:21:14 +02:00
Luis Davim 77414a6d18
fixes conflicts with some kubectl commands 2019-08-14 13:31:12 +01:00
Radovan Garabík 763fa396b1
Merge pull request #128 from luisdavim/patch-2
also skip colours for kubectl exec
2019-07-31 12:49:22 +02:00
Luis Davim 02f22d4cf4
also skip colours for kubectl exec 2019-07-31 11:39:18 +01:00
Radovan Garabík 01af1fdceb
Merge pull request #127 from luisdavim/patch-2
small improvements
2019-07-24 16:12:11 +02:00
Luis Davim 36ef164987
Update grc.conf 2019-07-24 12:55:32 +01:00
Luis Davim ad91fc4b2e
ignore if the command is kubectl edit 2019-07-24 12:54:11 +01:00
Luis Davim e83a11599c
Update conf.kubectl 2019-07-24 12:25:00 +01:00
Luis Davim 074fe6e3b1
small improvements
Improve compatibility with `kubrectl describe` and added a few more "red words"
2019-07-24 10:04:31 +01:00
Radovan Garabík c414dfd3b4 merge kubectl from luidavim 2019-07-24 10:26:44 +02:00
Radovan Garabík 9367d03d9f
Merge pull request #120 from richarson/richarson-dockerimages
grc.conf: Expand conf.dockerimages regex
2019-07-24 09:03:45 +02:00
Radovan Garabík 75e255c730
Merge pull request #119 from Raizo62/devel
grc.conf : correct the regular expression with ping, traceroute, ip, …
2019-07-24 09:00:48 +02:00
Radovan Garabík 98b4df7bd2
Merge pull request #118 from Raizo62/master
grc.conf : correct the regular expression with ping, traceroute, ip, …
2019-07-24 08:59:27 +02:00
Radovan Garabík eafbb9dded Merge branch 'devel' of github.com:garabik/grc into devel 2019-07-24 08:48:59 +02:00
Radovan Garabík 5c9d5abec4 Merge branch 'bretello-master' into devel 2019-07-24 08:47:45 +02:00
Radovan Garabík 5981e2ac1c conflict 2019-07-24 08:47:26 +02:00
Radovan Garabík 8267bab647
Merge pull request #113 from derimagia/zsh-autocomplete-fix
Fix zsh completions if --colour is used
2019-07-24 08:35:00 +02:00
Radovan Garabík c71b244b80
Merge pull request #121 from richarson/richarson-conf.uptime
conf.uptime: Support decimal comma
2019-07-24 08:28:15 +02:00
Ricardo J. Barberis ee07d1bd15
conf.uptime: Support decimal comma
So load averages also are colourised when e.g. LANG=es_ES
2019-04-25 19:57:24 -03:00
Ricardo J. Barberis 7df059ed67
Expand conf.dockerimages regex
Add 'image ls' and 'image list' as alternatives to 'images'
2019-04-20 15:14:24 -03:00
raizo62 270e11cb83 grc.conf : correct the regular expression with ping, traceroute, ip, journalctl, systemctl, sysctl : the '?' is for '\s', not for the last letter of the command 2019-04-06 11:59:52 +02:00
raizo62 edee9e7591 grc.conf : correct the regular expression with ping, traceroute, ip, journalctl, systemctl, sysctl : the '?' is for '\s', not for the last letter of the command 2019-04-06 11:45:09 +02:00
Dave Wikoff 9302d75f06 Fix zsh completions if --colour is used 2019-01-11 13:05:09 -05:00
Radovan Garabík b11c36fcba iwconfig quality/level 2018-12-26 21:33:04 +01:00
Radovan Garabík 5ca81657ab
Merge pull request #112 from Raizo62/iwconfig
iwconfig : Bit Rate can contain dots : Bit Rate=43.3 Mb/s
2018-12-26 21:19:34 +01:00
raizo62 4a37b7fc7c iwconfig : Bit Rate can contain dots : Bit Rate=43.3 Mb/s 2018-12-26 12:35:31 +01:00
Radovan Garabík ae79db506e fix infinite loop if replacement matches regexp again 2018-12-25 20:22:18 +01:00
Radovan Garabík 677295cb8f Merge branch 'kapsh-commands' into devel 2018-12-25 19:32:23 +01:00
Radovan Garabík b5726877be merge sensors command 2018-12-25 19:31:49 +01:00
Radovan Garabík c7856d4068 Merge branch 'franga2000-master' into devel 2018-12-24 21:27:06 +01:00
Radovan Garabík f32d8a1432 conflict 2018-12-24 21:26:56 +01:00
Miha Frangež 2b98e0767d Add config for sensors command 2018-10-09 20:56:13 +02:00
Alexander Kapshuna dd7ecc05d6 grc.zsh: alias ALL supported commands 2018-10-01 19:27:05 +03:00
Alexander Kapshuna 3abfc841db grc.conf: add missing sensors command 2018-10-01 19:25:05 +03:00
Alexander Kapshuna 7a5f76aeee No need to specify --colour as it defaults to auto 2018-10-01 19:24:39 +03:00
Radovan Garabík ae88b81759
Merge pull request #108 from erik-valdivieso/master
Fix packet loss percent with dot number
2018-09-26 16:42:52 +02:00
Radovan Garabík c1cb9b8941
Merge pull request #107 from florianbeer/patch-1
Update logfile config
2018-09-26 16:40:11 +02:00
Radovan Garabík 04665c00b5
Merge pull request #106 from iax7/master
Add new conf files and fix existing
2018-09-26 16:38:26 +02:00
Radovan Garabík 50174b2336
Merge pull request #94 from g0tmi1k/README
Add "Dynamic aliases"
2018-09-26 16:36:39 +02:00
Radovan Garabík 5bc9f4e70f tune lspci 2018-09-26 16:28:45 +02:00
Radovan Garabík 047bcc6c7a
Merge pull request #86 from kapsh/lspci
Tune lspci colors
2018-09-26 16:23:16 +02:00
Erik Valdivieso f3f76ad382
Fix packet loss percent with dot number
Works with

0%
0.0%
100%
100.0%
2018-08-29 11:31:01 -05:00
Florian Beer 918df658c2
Update logfile config
This commit refines how logfiles are displayed, so it is more suitable for webserver and mailserver logs in addition to generic kernel messages:

* Add colorization of strings in double quotes
* Alter parsing of pathnames to also include common URL path components
* Mark IPv4 and IPv6 addresses
* Detect email addresses
* Detect HTTP verbs and common HTTP and mailserver status codes

I think it is rather nice to look at and easy to visually parse important parts of each log line. Since I've been using this config for a long time on my servers I thought I should give back and make it available to the public.

Merge if you feel like it, if not it is here to copy for anyone that wants to. Thanks @garabik for your awesome tool!
2018-08-24 11:07:13 +02:00
Isaias Pina 1d07328d38
Add kubectl and yaml conf file 2018-08-09 22:14:04 -05:00
g0tmi1k 98ec00d036 Add "Dynamic aliases"
Based on: https://unix.stackexchange.com/questions/148/colorizing-your-terminal-and-shell-environment
2018-07-25 15:18:38 +01:00
Radovan Garabík d64b7c6523
Merge pull request #92 from iax7/master
Fix color files
2018-07-01 14:59:23 +02:00
Radovan Garabík 681408c3a5
Merge pull request #97 from tasnad/master
Fixed color for the ss command.
2018-07-01 14:54:21 +02:00
Radovan Garabík e0033c0a23
Merge pull request #99 from fanaugen/add_docker_compose
Add docker-compose to the shell init files
2018-07-01 14:51:14 +02:00
Radovan Garabík 8ec2f1a310
Merge pull request #98 from felixonmars/patch-1
Fix a typo in grc.1
2018-07-01 14:48:33 +02:00
Alex Jahraus d713c4fbce
Add docker-compose to the shell init files 2018-06-25 17:35:38 +02:00
Felix Yan 692cd20fba
Fix a typo in grc.1 2018-06-11 15:21:11 +08:00
Tasnad Kernetzky fc39736c78
Fixed conf.ss: Match all IPv6 addresses not only ::1 2018-06-06 11:24:53 +02:00
Tasnad Kernetzky 90de144c31
Merge pull request #1 from tasnad/tasnad-patch
Fix: brackets, address scope; match process name
2018-06-05 19:00:08 +02:00
Tasnad Kernetzky 66efc0dc3a
Fix: brackets, address scope; match process name
Newer versions of ss have a slightly different output syntax: IPv6 addresses are put in brackets (like in URLs).
tcp   LISTEN  0       32                       [::1]:53              [::]:*   
Also, the addresses' scope may be in the output:
192.168.1.1%eth0:68           0.0.0.0:*   users:(("NetworkManager",pid=82,fd=6)) ino:661155 sk:272 <->

I had to move the "status" regex or it would overwrite IPv6 addresses.
2018-06-05 18:57:20 +02:00
Isaias Pina e9fc71c699
Fix ipaddr, iproute and uptime colors 2018-05-14 15:53:27 -05:00
Isaias Pina e88d90ff0a
Add common file to highlight words in green,red,yellow 2018-05-14 15:48:48 -05:00
Isaias Pina 4c8b5a799a
Fix dig coloring single chars 2018-05-14 14:44:44 -05:00
Alexander Kapshuna 9c4796ff65 Tune lspci colors 2018-05-03 16:58:44 +03:00
Radovan Garabík 375b6c3443 remove duplicate findmnt 2018-04-29 16:54:46 +02:00
40 changed files with 1043 additions and 463 deletions

View File

@ -33,3 +33,4 @@ else:
If you're on OS X and using Homebrew,
brew install grc

View File

@ -161,9 +161,9 @@ there can be more attributes per line (separated by space), e.g.
will display pathnames in bold blinking green
## Python 3 compatibility
## Python 2 & 3 compatibility
There is some preliminary python3 support, meaning that both grc and grcat will run under both python2 and python3. However, all the regular expressions are strings, and grcat works on string input (not bytes). Therefore it will miserably fail if fed input with invalid UTF-8 characters.
both grc and grcat are targetted towards python3 now; there is an attempt at python2 compatibility, meaning that both grc and grcat will run under both python2 and python3. However, all the regular expressions are strings, and grcat works on string input (not bytes).
## Hints
@ -179,13 +179,16 @@ or, if you have recent BSD tail:
## Automatic aliases
You can start using grc automatically with supported commands. The following assumes that `grc.<bashrc|zsh|fish>` is in `/etc`. The location may differ (i. e. `/usr/local/etc` when installed with homebrew).
You can start using grc automatically with supported commands. The following assumes that `grc.<sh|zsh|fish>` is in `/etc`. The location may differ (i. e. `/usr/local/etc` when installed with [homebrew](https://formulae.brew.sh/formula/grc)); or the `grc.sh` can be placed into `/etc/profile.d/` (this is in fact the default). Be aware this is somewhat invasive and better test it before deploying.
### Bash
To set aliases for supported commands, append to your `~/.bashrc`:
[[ -s "/etc/grc.bashrc" ]] && source /etc/grc.bashrc
GRC_ALIASES=true
[[ -s "/etc/profile.d/grc.sh" ]] && source /etc/grc.sh
If the file `/etc/default/grc` exists, it is sourced first, therefore you can place a line saying `GRC_ALIASES=true` there.
### ZSH
@ -199,3 +202,11 @@ Add to `~/.config/fish/config.fish` or in a new file in `~/.config/fish/conf.d/`
source /usr/local/etc/grc.fish
## Dynamic aliases
By running the follow code, it will check to see what programs are already installed on your OS (based on your `$PATH`), and echo out the result. This could then be added to your shell resource file as a one off. Alternatively, by removing the `echo` in the code, it could be placed into your shell resource file directly, and it will create the necessarily aliases each time:
for cmd in g++ gas head make ld ping6 tail traceroute6 $( ls /usr/share/grc/ ); do
cmd="${cmd##*conf.}"
type "${cmd}" >/dev/null 2>&1 && echo alias "${cmd}"="$( which grc ) --colour=auto ${cmd}"
done

2
_grc
View File

@ -16,7 +16,7 @@ args=(
'(-e --stderr)'{-e,--stderr}'[redirect stderr; do not automatically redirect stdout]'
'(-s --stdout)'{-s,--stdout}'[redirect stdout; even with -e/--stderr]'
'(-c <name>--config=<name>)'{-c+,--config=-}'[use <name> as configuration file for grcat]:file:_files'
'--color=-[colo?urize output]:color:(on off auto)'
'--colour=-[colourize output]:colour:(on off auto)'
'(-h --help)'{-h,--help}'[display help message and exit]'
'--pty[run command in pseudotermnial (experimental)]'
'*::arguments:{ _normal }'

11
colourfiles/conf.common Normal file
View File

@ -0,0 +1,11 @@
# Green Words
regexp=[Ee]nabled?|[Oo]k|[Rr]unning|[Tt]rue
colour=green
-
# Red Words
regexp=[Dd]isabled?|[Ee]rrors?|[Ss]topped|[Ff]alse
colour=red
-
# Yellow Words
regexp=[Ww]arning
colour=yellow

72
colourfiles/conf.curl Normal file
View File

@ -0,0 +1,72 @@
# curl grc colorizer configuration
===
# Outgoing Headers
regexp=^(>) ([\w\-]+): (.*)
colours=default, bright_green, bright_blue, bright_cyan
===
# Incoming Headers
regexp=^(<) ([\w\-]+): (.*)
colours=default, bright_yellow, bright_blue, bright_cyan
===
# Incoming 200
regexp=(HTTP/[\d\.]+) 2\d{2} [\w\s]+
colours=bright_green on_blue, bright_white on_blue
===
# Incoming 300
regexp=(HTTP/[\d\.]+) 3\d{2}[\w\s]*
colours=bright_green on_blue, bright_white on_blue
===
# Incoming 400
regexp=(HTTP/[\d\.]+) 4\d{2} [\w\s]+
colours=bright_red on_blue, bright_white on_blue
===
# Incoming 500
regexp=(HTTP/[\d\.]+) 5\d{2} [\w\s]+
colours=bright_red on_blue, bright_white on_blue
===
# Server certificate
regexp=\* (Server certificate):
colours=magenta, bright_magenta
===
# Certificate Headers
regexp=\* ([a-z][\w\s\d]+): (.*)
colours=magenta, bright_blue, bright_cyan
===
# SSL certificate problem
regexp=SSL certificate problem:( .*)
colours=bright_red, bright_red
===
# SSL certificate verify result: self signed certificate (18), continuing anyway.
regexp=SSL certificate verify result:(.*)
colours=bright_magenta, bright_yellow
===
# SSL certificate verify ok.
regexp=SSL certificate verify (ok)
colours=bright_magenta, bright_green
===
# Verbose Logging
regexp=^([{}\*])\s
colours=default, bright_magenta
count=more
===
# Outgoing
regexp=^>\s
colours=bright_green
count=more
===
# Incoming
regexp=^<\s
colours=bright_yellow
count=more
===
# SSL connection
regexp= (SSL connection) using (.*) / (.*)
colours=magenta, bright_magenta, bright_magenta, bright_magenta
===
# Connected to...
regexp=(Connected) to (.*) \(([\d\.]+)\) port (\d+)
colours=magenta, bright_magenta, bright_magenta, bright_magenta, bright_magenta
===
# Outgoing METHOD
regexp=(GET|HEAD|POST|PUT|DELETE|CONNECT|OPTIONS|TRACE|PATCH) (/.*) HTTP/[\d\.]+
colours=bright_white on_blue, bright_white on_blue, bright_yellow on_blue

View File

@ -4,19 +4,19 @@ regexp=^(?!Filesystem)(\/[-\w\d.]+)+\s
colours=blue,bold blue
======
# Size 'K'
regexp=\s\d*[.,]?\dKi?\s
regexp=\s\d*[.,]?\d(K|B)i?\s|\b\d{1,3}\b
colours=green
======
# Size 'M'
regexp=\s\d*[.,]?\dMi?\s
regexp=\s\d*[.,]?\dMi?\s|\b\d{4,6}\b
colours=yellow
======
# Size 'G'
regexp=\s\d*[.,]?\dGi?\s
regexp=\s\d*[.,]?\dGi?\s|\b\d{7,9}\b
colours=red
======
# Size 'T'
regexp=\s\d*[.,]?\dTi?\s
regexp=\s\d*[.,]?\dTi?\s|\b\d{10,12}\b
colours=bold red
======
# Mounted on
@ -24,19 +24,19 @@ regexp=\/$|(\/[-\w\d. ]+)+$
colours=green,bold green
======
# Use 0-60%
regexp=[\b1-6][0-9]?%|0%
regexp=\s[1-6]?[0-9]%\s
colours=green
======
# Use 70-90%
regexp=[7-9][0-9]%
# Use 70-89%
regexp=\s[78][0-9]%\s
colours=yellow
======
# Use 90-97
regexp=9[0-7]%
# Use 90-97%
regexp=\s9[0-7]%\s
colours=red
======
# Use 98-100
regexp=9[8-9]%|100%
# Use 98-100%
regexp=\s9[89]%|100%\s
colours=bold red
======
# tmpfs lines

View File

@ -1,31 +1,23 @@
#ipv6
regexp=(([0-9a-fA-F]{1,4})?\:\:?[0-9a-fA-F]{1,4})+
colours=green
=======
#time
regexp=\s[0-9]{1,6}\s
colours=red
=======
#type
regexp=[A-Z]{1,4}
colours=cyan
=======
#in
regexp=(IN|CH)
colours=yellow
=======
#domain
regexp=[a-z0-9-]+\.
colours=magenta
=======
#ip address
regexp=[\S]+\.
colours=bright_magenta
-
#line
regexp=^(\S+).*?(\d+)\t(\w+)\t(\w+)\t
colours=unchanged,magenta,red,yellow,cyan
-
#ip4 address
regexp=\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}
colours=green
=======
-
#ipv6
regexp=\t(([0-9a-fA-F]{1,4})?\:\:?[0-9a-fA-F]{1,4})+
colours=dark green
-
#comments
regexp=^;;\s\w*\s*\w*
regexp=^;;[\s\w]+
colours=yellow
=======
-
#Title
regexp=; <<>> DiG (\d+\.\d+\.\d+).*<<>>\s(\S+)$
colours=default,green,bold magenta
regexp=; <<>> DiG.* <<>> (\S+)
colours=default,bold magenta

View File

@ -17,9 +17,21 @@ colours=blue
# Statuses
# https://github.com/docker/docker/blob/e5a3f86e447dd659da3c2e759f3c088a0bfcfe3d/container/state.go#L40
# Up
regexp=(?:\s{2}|^)(?:Up|Restarting)(?:(?:\s[\w,\d,(,)]+)+)?
regexp=(?:\s{2}|^)(?:Up|Restarting)(?:(?:\s[\w,\d]+)+)?
colours=bold green
======
# Health - healthy
regexp=\s\(healthy\)
colours=bold green
======
# Health - starting
regexp=\s\(health: starting\)
colours=bold yellow
======
# Health - unhealthy
regexp=\s\(unhealthy\)
colours=bold red
======
# Statuses - Exited
regexp=Exited\s.(\d+).+?(?=\s{2,})
colours=bold red,red
@ -28,9 +40,13 @@ colours=bold red,red
regexp=Restarting\s.(\d+).+?(?=\s{2,})
colours=bold blue
======
# Ip Addresses / Ports
regexp=(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}(\:)?(\d{1,5}))?(?:->)?(\d{1,5}(\/)\w+)
colours=default,blue,default,bright_green,bright_blue,default
# Ip Addresses
regexp=(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})(\:)?
colours=default,blue,default
======
# Ports
regexp=(\d{1,5})?(-)?(\d{1,5})?(->)?(\d{1,5})(-)?(\d{1,5})?(\/)(tcp|udp)
colours=default,bright_green,default,bright_green, default, bright_green,default,bright_green,default,cyan
======
# NAMES
regexp=(?:([a-z\-_0-9]+)\/)*([a-z\-_0-9]+)$

View File

@ -7,19 +7,31 @@ regexp=\s+[\.\/]+([\w\s\-\_\.]+)(\/.*)?$
colours=default,bold blue,blue
======
# Size 'K'
regexp=^\d*[.,]?\dKi?\s
regexp=^\d{1,3}\s
colours=green
======
regexp=^ ?\d*[.,]?\dKi?\s
colours=green
======
# Size 'M'
regexp=^\d*[.,]?\dMi?\s
regexp=^\d{4,6}\s
colours=yellow
======
regexp=^ ?\d*[.,]?\dMi?\s
colours=yellow
======
# Size 'G'
regexp=^\d*[.,]?\dGi?\s
regexp=^\d{7,9}\s
colours=red
======
regexp=^ ?\d*[.,]?\dGi?\s
colours=red
======
# Size 'T'
regexp=^\d*[.,]?\dTi?\s
regexp=^\d{10,12}\s
colours=bold red
======
regexp=^ ?\d*[.,]?\dTi?\s
colours=bold red
======
# Total

4
colourfiles/conf.dummy Normal file
View File

@ -0,0 +1,4 @@
# for testing purposes, do match but do not change anything
regexp=([a-g]+)
colour=''

View File

@ -1,17 +1,17 @@
# Size 'K'
regexp=\s\d*[.,]?\dKi?
regexp=\s\d*[.,]?\dKi?|\b\d{1,3}\b
colours=green
======
# Size 'M'
regexp=\s\d*[.,]?\dMi?
regexp=\s\d*[.,]?\dMi?|\b\d{4,6}\b
colours=yellow
======
# Size 'G'
regexp=\s\d*[.,]?\dGi?
regexp=\s\d*[.,]?\dGi?|\b\d{7,9}\b
colours=red
======
# Size 'T'
regexp=\s\d*[.,]?\dTi?
regexp=\s\d*[.,]?\dTi?|\b\d{10,12}\b
colours=bold red
======
# Mem

21
colourfiles/conf.go-test Normal file
View File

@ -0,0 +1,21 @@
# go-test grc colorizer configuration
regexp==== RUN .*
colour=bright_blue
-
regexp=--- PASS: .* (\(\d+\.\d+s\))
colour=green, yellow
-
regexp=^PASS$
colour=bold white on_green
-
regexp=^(ok|FAIL)\s+.*
colour=default, magenta
-
regexp=--- FAIL: .* (\(\d+\.\d+s\))
colour=red, yellow
-
regexp=^FAIL$
colour=bold white on_red
-
regexp=[^\s]+\.go(:\d+)?
colour=cyan

View File

@ -16,7 +16,7 @@ regexp=\d+(\.\d+)?\s(T|G|M|K|)i?B
colours=yellow
=======
# interface
regexp=^([a-z0-9]{2,}\d*):?\s
regexp=^([a-z0-9.]{2,}\d*):?\s
colours=bold green
=======
#ip disc

View File

@ -3,8 +3,12 @@ regexp=inet\s([^\/]+)\/(\d+)
colours=default,bold yellow,bold magenta
=====
# broadcast
regexp=brd\s([^}s]+)
colours=default,dark
regexp=brd\s([^}\s]+)
colours=default,dark cyan
=====
# dynamic
regexp=\bdynamic\b
colours=dark green
=====
# IP6
regexp=inet6\s([^\/]+)\/(\d+)
@ -34,6 +38,10 @@ colours=default,bright_white,bold cyan,cyan
regexp=\s<([^>]+)>
colours=default,cyan
=====
# NO-CARRIER
regexp=NO-CARRIER
colours=bold red
=====
# Master dev
regexp=\smaster\s(\S+)\s
colours=default,on_blue white

View File

@ -22,6 +22,10 @@ colours=default,magenta,bold magenta
regexp=(proto)\s(\S+)\s
colours=default,default,dark yellow
=====
# metric
regexp=(metric)\s(\d+)\b
colours=default,default,bold white
=====
# linkdown
regexp=linkdown
colours=bold red

View File

@ -11,7 +11,7 @@ regexp=802\.11([a-z]+)
colours=bold yellow
=======
# Speed
regexp=[0-9]+ Mb/s
regexp=[0-9\.]+ Mb/s
colours=bold yellow
=======
# Tx-Power
@ -50,6 +50,10 @@ colours=blue
regexp=(?i)mtu(\s|\:)\d+
colours=green
=======
# quality/level/sensitivity
regexp=(\d+/\d+)
colours=bold yellow
=======
#errors
regexp=errors(\s|\:)\d+
colours=red

75
colourfiles/conf.kubectl Normal file
View File

@ -0,0 +1,75 @@
# Green Words
regexp=\b(Ready|Running|[Tt]rue|Active|Available|Approved|created)\b
colour=unchanged,green
-
# Master
regexp=\smaster\s
colour=on_green bold white
-
# Red Words
regexp=\b([Dd]isabled?|[Ee]rrors?|[Ss]topped|[Ff]alse|none|ErrImagePull|[a-zA-Z]+BackOff|OOMKilled|[Tt]erminated|[Ff]aile?d?)\b
colour=unchanged,red
-
# Yellow Words
regexp=\b([Ww]arning|[Pp]ending|[Ww]aiting|ContainerCreating|Released|Bound|already exists)\b
colour=unchanged,yellow
-
# Completed Jobs
regexp=\b(Completed)\b
colour=unchanged,dark green
-
# Misc IP
regexp=\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}(/\d{1,2})?
colour=cyan,magenta
-
# Ports
regexp=(\d+)(:\d+)?/(TCP|UDP)
colour=unchanged,yellow,bold green,magenta
-
# Type/Name
regexp=^([^/ ]+)/(\S+)
colour=unchanged,yellow,bright_white
-
# No running Instances
regexp=\s(0/[1-9]+)\b
colour=unchanged,bold red
-
# Labels
regexp=([\w\d\-_\/.]+)=([\w\d\-_./]+)(,| |$)
colour=unchanged,blue,bright_yellow
-
# YAML First level (PSEUDO)
regexp=^([\w\d \-]+):
colours=unchanged,bright_blue
-
# YAML Nested
regexp=^[ \-]+(\S+):
colours=unchanged, blue
-
# YAML number
regexp=: (\d+)$
colours=unchanged, yellow
-
# Explicit String
regexp="(\S*)(?=")
colours=default,cyan
-
# Empy
regexp=(\<?[Nn]one\>?|null)
colours=magenta
-
# Events title
regexp=\s+(Type)\s+(Reason)\s+(Age)\s+(From)\s+(Message)
colours=cyan, cyan, cyan, cyan, cyan, magenta
-
# Title separator
regexp=\s+\-{3,}
colours=dark white
-
# HELP Highlight
regexp=( --[^= ]+| -[a-zA-Z]( |,))
colour=bright_green
-
# Higlight (Tested in kubectl config get-contexts)
regexp=^\*.+$
colour=bold white

View File

@ -16,14 +16,16 @@ regexp=.*last message repeated \d+ times$
colours=yellow
count=stop
======
# this is date
regexp=^... (\d| )\d \d\d:\d\d:\d\d(\s[\w\d]+?\s)
# this is date and hostname
# 'Jun 3 22:44:55 neutronium '
# 'Jun 3 22:44:55 neutronium-02.my-domain.io '
regexp=^... (\d| )\d \d\d:\d\d:\d\d(\s[-.\w\d]+?\s)
colours=green, green, red
count=once
======
# everything in parentheses
regexp=\(.+?\)
colours=green
regexp=\(.*?\)
colours=blue
count=more
======
# everything in `'
@ -31,9 +33,18 @@ regexp=\`.+?\'
colours=bold yellow
count=more
======
# everything in "
regexp=\".*?\"
colours=blue
======
# this is probably a pathname
regexp=/[\w/\.]+
colours=bold green
regexp=\s/[a-zA-Z_/\.\-\?\d\=\&]+
colours=blue
count=more
======
# everything in <>
regexp=\<.*?\>
colours=blue
count=more
======
# name of process and pid
@ -41,13 +52,44 @@ regexp=([\w/\.\-]+)(\[\d+?\])
colours=bold blue, bold red
count=more
======
# ip number
regexp=\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}
colours=bold magenta
# IPv4 or IPv4:Port
regexp=\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}(:\d{1,5})?
colours=bold yellow
count=more
======
# IPv6
regexp=(([0-9a-fA-F]{1,4})?\:\:?[0-9a-fA-F]{1,4})+
colours=bold yellow
=======
# Email address
regexp=[a-zA-z0-9\.\-\+]+\@[\w\-\.]+
colours=green
======
# HTTP verbs
regexp=GET|POST|PUT|DELETE|PATCH|HEAD
colours=green
======
# 2xx status
regexp=\s\b2\d{2}\b\s
colours=green
======
# 3xx status
regexp=\s\b3\d{2}\b\s
colours=yellow
======
# 4xx status
regexp=\s\b4\d{2}\b\s
colours=red
======
# 5xx status
regexp=\s\b5\d{2}\b\s
colours=red
======
# status deferred
regexp=status\=deferred|Connection refused
colours=red
======
# connect requires special attention
regexp=connect
colours=on_red
count=more

View File

@ -3,7 +3,7 @@ regexp=^(..):(..).(.)
colours=default,bright_green,bright_yellow,red
-
# Ethernet
regexp=(Ethernet controller|Network controller)
regexp=(Ethernet|Network) controller:
colours=cyan
-
# Wireless
@ -11,9 +11,26 @@ regexp=Wireless
colours=bright_cyan
-
# SATA
regexp=SATA controller
regexp=SATA controller:
colours=green
-
# Audio
regexp=Audio device
regexp=Audio device:
colours=blue
-
# Video
regexp=VGA compatible controller:
colours=magenta
-
# Bridges
regexp=(PCI|ISA|Host) bridge:
colours=red
-
# any unspecified controller
regexp=([A-Z].+?) controller:
colours=blue
-
# For lspci -k
regexp=Kernel (?:modules|driver in use): (.+)
colours=default,bright_red
-

View File

@ -27,11 +27,11 @@ regexp=DUP\!
colours=red
=======
# OK
regexp=0% packet loss
regexp= 0(\.0)?% packet loss
colours=green
=======
# Errors
regexp=(Destination Host Unreachable|100% packet loss)
regexp=(Destination Host Unreachable|100(\.0)?% packet loss)
colours=red
=======
# unknown host

View File

@ -1,12 +1,28 @@
# Adapetr
regexp=Adapter:\s(.*)
colours=default, green
# Sensor name
regexp=([a-z\-0-9]+)
colours=underline yellow
======
# High temperature
regexp=.+:\s+(\+[67][0-9][^0-9])
colours=default, red
# Data names
regexp=(.+:)\s+(.+)
colours=unchanged, bright_cyan, default
======
# Very high temperature
regexp=.+:\s+(\+[89][0-9][0-9]?)
colours=default, blink red
# Extra info
regexp=.+\s+(\(.+\))
colours=unchanged, bright_black
======
# Adapter name
regexp=Adapter:(\s.*)
colours=unchanged, yellow
======
# Low temperature (below 60)
regexp=.+:\s+(\+[2345][0-9]\.[0-9]°C)
colours=unchanged, green
======
# High temperature (above 60)
regexp=.+:\s+(\+[67][0-9]\.[0-9]°C)
colours=unchanged, bright_yellow
======
# Very high temperature (above 80)
regexp=.+:\s+(\+[89][0-9]\.[0-9]°C)
colours=unchanged, bright_red
======

93
colourfiles/conf.sockstat Normal file
View File

@ -0,0 +1,93 @@
=======
# CAPS LINE
regexp=^[A-Z\s%]*([A-Z]{3})[A-Z\s%]*$
colours=underline
=======
# root
regexp=^root(?=\s|$)
colours=bold red
=======
# non-root users
regexp=^(?:(?!root|USER))([^\s]+)
colours=bold yellow,unchanged
=======
# CMD
regexp=^[a-zA-Z]+\w+\s+(\w+)\s+\d+
colours=unchanged,bold cyan
=======
# FD
regexp=^[a-zA-Z]+\w+\s+\w+\s+\d+\s+(\d+)
colours=unchanged,yellow
=======
# PID
regexp=^[a-zA-Z]+\w+\s+[a-zA-Z]+\w+\s+(\d+)
colours=unchanged,bold magenta
=======
# PROTOCOLS
regexp=(tcp4|udp4|tcp6|udp6|stream|dgram)
colours=bold blue
=======
# hostname:service
regexp=([\w\.\-]+):([\w\-]+)\b
colours=yellow, bold green, bold yellow
=======
# hostname:port
regexp=([\w\.\-]+):(\d+)\b
colours=yellow, bold green, bold red
=======
# *:service
regexp=(\*):([\w\-]+)\b
colours=yellow, yellow, bold red
=======
# PATH
regexp=\s\/.*\/(\S+)($| \(.*\))
colours=green,bright_green,red
=======
# status
regexp=FIN_WAIT.*
colours=red
=======
# status
regexp=SYN.*?
colours=bold red
=======
# status
regexp=LISTEN(ING)?
colours=bold blue
=======
# status
regexp=TIME_WAIT
colours=bold red
=======
# status
regexp=CLOS(E(_WAIT)?|ING)
colours=red
skip=yes
=======
# status
regexp=LAST_ACK
colours=red
=======
# status
regexp=ESTAB.*?\b|CONNECTED
colours=bold yellow
=======
# status
regexp=FREE
colours=bold green
=======
# status
regexp=DISCONNECTING
colours=red
=======
# status
regexp=CONNECTING
colours=green
=======
# status
regexp=CONNECTING
colours=green
=======
# status
regexp=UNKNOWN
colours=blink bold red

View File

@ -1,6 +1,14 @@
# Local Address:Port
regexp=\s((?:\d+\.){3}\d+|\*|::1?|[\w\d\-\_\.]+):(\S+)\s+\s((?:\d+\.){3}\d+|\*|::1?|[\w\d\-\_\.]+):(\S+)
colours=default,bright_green,bright_red,cyan,magenta
# status
regexp=\[.*\]
colours=green
=======
# Local Address:Port Peer Address:Port
regexp=\s((?:\d+\.){3}\d+|\*|\[?[\da-fA-F\.:]+\]?|[\w\d\-\_\.]+)(%[\w\d]+)?:(\S+)\s+\s((?:\d+\.){3}\d+|\*|\[?[\da-fA-F\.:]+\]?|[\w\d\-\_\.]+):(\S+)
colours=default,bright_green,blue,bright_red,cyan,magenta
=======
# process name
regexp=\("([^"]+)",
colours=blue
=======
# ipx hostname
regexp=^IPX.*[\dABCDEF]+:[\dABCDEF]+
@ -67,10 +75,6 @@ colours=green
regexp=UNKNOWN
colours=blink bold red
=======
# status
regexp=\[.*\]
colours=green
=======
# path
regexp=(\@)[\dabcdef]+
colours=green, bold green

View File

@ -24,10 +24,8 @@ regexp=\bDUP
colours=red
-
# !S, !A, !H (host unreachable), etc.
regexp=\b\![AFGNPSTU]
regexp=\s\!([HNPSFXVC]|\d+)
colours=red
# just an example:
#command=echo 'Network is down'| mail root
-
# ttl=...!
regexp=ttl=\d+\!

View File

@ -1,13 +1,13 @@
# Time
regexp=\sup(?:\s(\d+ days?),)?\s+(\d+ min|\d+:\d+),
colours=default,yellow,green
# Regular Up
regexp=\sup(?: (\d+) days?,)? +(\d+ min|\d+:\d+)(?=,)
colours=green,bold green, bold green
-
# users
regexp=\s+(\d+)\susers
regexp=\b(\d+) users?
colours=yellow,bold yellow
-
# load average
regexp=load average: (\d+\.\d+),\s(\d+\.\d+),\s(\d+\.\d+)
regexp=load average: (\d+[\.,]\d+),\s(\d+[\.,]\d+),\s(\d+[\.,]\d+)
colours=default,bright_cyan,cyan,dark cyan
-
# W Command section

35
colourfiles/conf.yaml Normal file
View File

@ -0,0 +1,35 @@
# Document
regexp=---
colours=bold yellow
-
# First level
regexp=^(\S+):
colours=unchanged,blue
-
# Nested
regexp=^ +(\S+):
colours=unchanged,blue
-
# Set Var
regexp=&\S+
colours=bold green
-
# Use Var
regexp=\*\S+
colours=on_green black
-
# Array
regexp=-\s
colours=bold magenta
-
# << Inheritance
regexp=<<
colours=bold red
-
# Explicit String
regexp="(\S*)(?=")
colours=default,cyan
-
# Explicit Number
regexp= (\d*)$
colours=unchanged,yellow

28
debian/changelog vendored
View File

@ -1,3 +1,31 @@
grc (1.13.1-1) unstable; urgency=low
* fix `ip addr` broadcast colouring
-- Radovan Garabík <garabik@kassiopeia.juls.savba.sk> Sun, 22 Aug 2021 13:36:39 +0200
grc (1.13-2) unstable; urgency=medium
* Source only upload (closes: #983793)
-- Radovan Garabík <garabik@kassiopeia.juls.savba.sk> Fri, 20 Aug 2021 16:38:48 +0200
grc (1.13-1) unstable; urgency=low
* do not add sh aliases unless explicitly allowed in /etc/default/grc
(closes: #984629)
* several minor improvements
-- Radovan Garabík <garabik@kassiopeia.juls.savba.sk> Sat, 07 Aug 2021 17:37:55 +0200
grc (1.12-1) unstable; urgency=low
* add new configurations
* improved zsh alias support
* various small bugfixes and improvements
-- Radovan Garabík <garabik@kassiopeia.juls.savba.sk> Mon, 01 Mar 2021 09:41:35 +0100
grc (1.11.3-1) unstable; urgency=medium
* add new configurations

2
debian/compat vendored
View File

@ -1 +1 @@
9
10

2
debian/control vendored
View File

@ -2,7 +2,7 @@ Source: grc
Section: text
Priority: optional
Maintainer: Radovan Garabík <garabik@kassiopeia.juls.savba.sk>
Standards-Version: 3.9.6
Standards-Version: 4.5.1
Build-Depends: debhelper (>=9), python3, dh-python
Package: grc

5
debian/copyright vendored
View File

@ -16,7 +16,10 @@ The original source can be found at:
It is released under GPL v2 or any later version, under Debian
systems see /usr/share/common-licenses/GPL-2,
with following additional condition:
and I have nothing against adding following additional condition (this is
however not the part of the license, which remains GPL v2 or any later
version):
If you want to use, redistribute, modify, abuse and molest grc in any
way, and you feel like it, you may add any clause to the license, as
long as it does not put any additional responsibility for behaviour of

9
debian/grc.default vendored Normal file
View File

@ -0,0 +1,9 @@
# add colourifying aliases for sh and bash shells
# true or false
#
# since this is rather invasive, it defaults to false
#
# changing it makes your shell source /etc/profile.d/grc
GRC_ALIASES=false

14
debian/rules vendored
View File

@ -19,8 +19,6 @@ install:
# Add here commands to install the package into debian/tmp.
./install.sh `pwd`/debian/grc/usr `pwd`/debian/grc
# this is too invasive, would be incluided in a next major version
rm `pwd`/debian/grc/etc/profile.d/grc.bashrc
build: build-arch build-indep
build-arch: build-stamp
@ -39,18 +37,18 @@ binary-indep: build install
dh_testroot
# dh_installdebconf
dh_installdocs
dh_installexamples
dh_installmenu
# dh_installexamples
# dh_installmenu
# dh_installemacsen
# dh_installpam
# dh_installinit
dh_installcron
dh_installinit
# dh_installcron
dh_installman grc.1 grcat.1
dh_installinfo
# dh_installinfo
# dh_undocumented
dh_installchangelogs
dh_link
dh_strip
# dh_strip
dh_compress
dh_fixperms
# You may want to make some executables suid here.

42
grc
View File

@ -6,11 +6,11 @@ import os, re, string, sys, getopt, signal
def version():
print ("Generic Colouriser 1.11.3")
print ("Generic Colouriser 1.13")
sys.exit()
def help():
print("""Generic Colouriser 1.11.3
print("""Generic Colouriser 1.13
grc [options] command [args]
Options:
-e --stderr redirect stderr. If this option is selected,
@ -26,7 +26,6 @@ Options:
def catch_signal(signum, frame):
"catch signal sent to grc and forward it to the original application"
global pidp
# print('signal')
try:
os.kill(pidp, signum)
except OSError: # if the subprocess already died
@ -81,38 +80,33 @@ if stdoutf == 1:
if use_pty:
import pty
conffile = None
if cfile == "":
home = os.environ.get('HOME')
xdg = os.environ.get('XDG_CONFIG_HOME')
if not xdg and home:
xdg = home + '/.config'
conffilenames = []
conffilenames = ['/etc/grc.conf', '/usr/local/etc/grc.conf']
if xdg:
conffilenames += [xdg + '/grc/grc.conf']
if home:
conffilenames += [home + '/.grc/grc.conf']
conffilenames += ['/usr/local/etc/grc.conf', '/etc/grc.conf']
for i in conffilenames:
# test if conffile exists, it can be also a pipe
if os.path.exists(i) and not os.path.isdir(i):
conffile = i
break
regexplist = []
if conffile:
f = open(conffile, "r")
while 1:
l = f.readline()
if l == "":
break
if l[0] == "#" or l[0] == '\012':
continue
regexp = l.strip()
if re.search(regexp, ' '.join(args)):
cfile = f.readline().strip()
break
for conffile in conffilenames:
# test if conffile exists, it can be also a pipe
if os.path.exists(conffile) and not os.path.isdir(conffile):
f = open(conffile, "r")
while 1:
l = f.readline()
if l == "":
break
if l[0] == "#" or l[0] == '\012':
continue
regexp = l.strip()
if re.search(regexp, ' '.join(args)):
cfile = f.readline().strip()
break
signal.signal(signal.SIGINT, catch_signal)

2
grc.1
View File

@ -13,7 +13,7 @@ with optional parameters
.I "[args]"
piping its stdout or stderr into
.BR grcat ",
with apropriate configuration file.
with appropriate configuration file.
Configuration file for
.BR grc

572
grc.conf
View File

@ -1,3 +1,295 @@
# configure command
^([/\w\.]+\/)?configure\b
conf.configure
# ping command
^([/\w\.]+\/)?(io|o|n|h|arp|l2)?ping[236]?\b
conf.ping
# traceroute command
^([/\w\.]+\/)?traceroute6?\b
conf.traceroute
# gcc command
^([/\w\.]+\/)?(g?cc|[gc]\+\+)\s
conf.gcc
# make command
^([/\w\.]+\/)?g?make\b
conf.gcc
# netstat command
^([/\w\.]+\/)?netstat\b
conf.netstat
# stat command
^([/\w\.]+\/)?stat\b
conf.stat
# ss command
^([/\w\.]+\/)?ss\b
conf.ss
# diff command
^([/\w\.]+\/)?diff\b
conf.diff
# wdiff command
^([/\w\.]+\/)?wdiff\b
conf.wdiff
# last/who command
^([/\w\.]+\/)?(lastb?|who|lastlog)\b
conf.last
# ldap tools
^([/\w\.]+\/)?ldap\b
conf.ldap
# cvs command
^([/\w\.]+\/)?cvs\b
conf.cvs
# mount command
^([/\w\.]+\/)?mount\b
conf.mount
# findmnt command
^([/\w\.]+\/)?findmnt\b
conf.findmnt
# mtr command
^([/\w\.]+\/)?mtr\b
conf.mtr
# ps command
^([/\w\.]+\/)?ps\b
conf.ps
# dig command
^([/\w\.]+\/)?dig\b
conf.dig
# ifconfig command
^([/\w\.]+\/)?ifconfig\b
conf.ifconfig
# ls command
^([/\w\.]+\/)?ls\s
conf.ls
# mount
^([/\w\.]+\/)?mount\b
conf.mount
# df
^([/\w\.]+\/)?df\b
conf.df
# du
^([/\w\.]+\/)?du\b
conf.du
# ip addr/link
^([/\w\.]+\/)?ip( -\w+)* a(d(d(r(e(ss?)?)?)?)?)?\b
conf.ipaddr
^([/\w\.]+\/)?ip( -\w+)* l(i(nk?)?)?\b
conf.ipaddr
# ip route
^([/\w\.]+\/)?ip( -\w+)* r(o(u(te?)?)?)?\b
conf.iproute
# ip neighbor
^([/\w\.]+\/)?ip( -\w+)* n(e(i(g(h(b(o(ur?)?)?)?)?)?)?)?\b
conf.ipneighbor
# ip command - rest of commands
^([/\w\.]+\/)?ip\b
conf.ip
# env
^([/\w\.]+\/)?env\b
conf.env
# systemctl show
^([/\w\.]+\/)?systemctl show\b
conf.env
# iptables
^([/\w\.]+\/)?iptables\b
conf.iptables
# lspci
^([/\w\.]+\/)?lspci\b
conf.lspci
# lsblk
^([/\w\.]+\/)?lsblk\b
conf.lsblk
# lsof
^([/\w\.]+\/)?lsof\b
conf.lsof
# blkid
^([/\w\.]+\/)?blkid\b
conf.blkid
# id
^([/\w\.]+\/)?id\b
conf.id
# iostat / sar
^([/\w\.]+\/)?(iostat|sar)\b
conf.iostat_sar
# fdisk
^([/\w\.]+\/)?fdisk -l\b
conf.fdisk
# free
^([/\w\.]+\/)?free\b
conf.free
------------
# docker
# docker ps
^([/\w\.]+\/)?docker(-compose)? ps\b
conf.dockerps
^([/\w\.]+\/)?docker image(s| ls| list)\b
conf.dockerimages
^([/\w\.]+\/)?docker search\b
conf.dockersearch
#^([/\w\.]+\/)?docker pull\b
#conf.dockerpull
^([/\w\.]+\/)?docker-machine ls\b
conf.docker-machinels
^([/\w\.]+\/)?docker network ls\b
conf.dockernetwork
^([/\w\.]+\/)?docker info\b
conf.dockerinfo
^([/\w\.]+\/)?docker version\b
conf.dockerversion
------------
# journalctl command
^([/\w\.]+\/)?journalctl\b
conf.log
# KubeCTL
^([/\w\.]+\/)?kubectl((?!edit|exec|run|go-template).)*$
conf.kubectl
# sensors command
^([/\w\.]+\/)?sensors\b
conf.sensors
# systemctl command
^([/\w\.]+\/)?systemctl\b
conf.systemctl
# sysctl command
^([/\w\.]+\/)?sysctl\b
conf.sysctl
# tcpdump command
^([/\w\.]+\/)?tcpdump\b
conf.tcpdump
# tune2fs command
^([/\w\.]+\/)?tune2fs\b
conf.tune2fs
# lsmod
^([/\w\.]+\/)?lsmod\b
conf.lsmod
# lsattr
^([/\w\.]+\/)?lsattr\b
conf.lsattr
# semanage ---------------------------------
^([/\w\.]+\/)?semanage boolean\b
conf.semanageboolean
^([/\w\.]+\/)?semanage fcontext\b
conf.semanagefcontext
^([/\w\.]+\/)?semanage (user|login|port)\b
conf.semanageuser
# getsebool
^([/\w\.]+\/)?getsebool\b
conf.getsebool
# ulimit
^([/\w\.]+\/)?ulimit\b
conf.ulimit
# vmstat
^([/\w\.]+\/)?vmstat\b
conf.vmstat
# dnf
^([/\w\.]+\/)?dnf\b
conf.dnf
# nmap
^([/\w\.]+\/)?nmap\b
conf.nmap
# uptime | w
^([/\w\.]+\/)?(uptime|w)\b
conf.uptime
# getfacl
^([/\w\.]+\/)?getfacl\b
conf.getfacl
# ntpdate
^([/\w\.]+\/)?ntpdate\b
conf.ntpdate
# showmount
^([/\w\.]+\/)?showmount\b
conf.showmount
# apache ant command
^([/\w\.]+\/)?ant\b
conf.ant
# # apache maven command
^([/\w\.]+\/)?mvn\b
conf.mvn
# iwconfig command
^([/\w\.]+\/)?iwconfig\b
conf.iwconfig
# lolcat command
^([/\w\.]+\/)?lolcat\b
conf.lolcat
# whois
^([/\w\.]+\/)?whois\b
conf.whois
# go test
^([/\w\.]+\/)?go test\b
conf.go-test
# sockstat command
^([/\w\.]+\/)?sockstat\b
conf.sockstat
# anything to do with irc
\b\w+\b.*irc.*
conf.irclog
@ -6,284 +298,4 @@ conf.irclog
\b\w+\b.*log\b
conf.log
# configure command
(^|[/\w\.]+/)?configure
conf.configure
# ping command
(^|[/\w\.]+/)(io|o|n|h|arp|l2)?ping[236]?\s
conf.ping
# traceroute command
(^|[/\w\.]+/)traceroute6?\s
conf.traceroute
# gcc command
(^|[/\w\.]+/)(g?cc|[gc]\+\+)\s
conf.gcc
# make command
(^|[/\w\.]+/)g?make\s?
conf.gcc
# netstat command
(^|[/\w\.]+/)netstat\s?
conf.netstat
# stat command
(^|[/\w\.]+/)stat\s?
conf.stat
# ss command
(^|[/\w\.]+/)ss\s?
conf.ss
# diff command
(^|[/\w\.]+/)diff\s?
conf.diff
# wdiff command
(^|[/\w\.]+/)wdiff\s?
conf.wdiff
# last/who command
(^|[/\w\.]+/)(lastb?|who|lastlog)\b
conf.last
# ldap tools
(^|[/\w\.]+/)ldap
conf.ldap
# cvs command
(^|[/\w\.]+/)cvs\s?
conf.cvs
# mount command
(^|[/\w\.]+/)mount\s?
conf.mount
# findmnt command
(^|[/\w\.]+/)findmnt\s?
conf.findmnt
# mtr command
(^|[/\w\.]+/)mtr\s?
conf.mtr
# ps command
(^|[/\w\.]+/)ps\s?
conf.ps
# dig command
(^|[/\w\.]+/)dig\s?
conf.dig
# ifconfig command
(^|[/\w\.]+/)ifconfig\s?
conf.ifconfig
# ls command
(^|[/\w\.]+/)ls\s
conf.ls
# mount
(^|[/\w\.]+/)mount\s?
conf.mount
# df
(^|[/\w\.]+/)df\s?
conf.df
# du
(^|[/\w\.]+/)du\s?
conf.du
# ip addr/link
(^|[/\w\.]+/)ip a(ddr)*\s?
conf.ipaddr
(^|[/\w\.]+/)ip ?(-.)* ?l(ink)*\s?
conf.ipaddr
# ip route
(^|[/\w\.]+/)ip r(oute)*\s?
conf.iproute
# ip neighbor
(^|[/\w\.]+/)ip n(eighbor)*\s?
conf.ipneighbor
# ip command - rest of commands
(^|[/\w\.]+/)ip?\s
conf.ip
# env
(^|[/\w\.]+/)env\s?
conf.env
# systemctl show
(^|[/\w\.]+/)systemctl show\s?
conf.env
# iptables
(^|[/\w\.]+/)iptables\s?
conf.iptables
# lspci
(^|[/\w\.]+/)lspci\s?
conf.lspci
# lsblk
(^|[/\w\.]+/)lsblk\s?
conf.lsblk
# lsof
(^|[/\w\.]+/)lsof\s?
conf.lsof
# blkid
(^|[/\w\.]+/)blkid\s?
conf.blkid
# id
(^|[/\w\.]+/)id\s?
conf.id
# iostat / sar
(^|[/\w\.]+/)(iostat|sar)\s?
conf.iostat_sar
# fdisk
(^|[/\w\.]+/)fdisk -l\s?
conf.fdisk
# free
(^|[/\w\.]+/)free\s?
conf.free
# findmnt
(^|[/\w\.]+/)findmnt\s?
conf.findmnt
------------
# docker
# docker ps
(^|[/\w\.]+/)docker(-compose)? ps\s?
conf.dockerps
(^|[/\w\.]+/)docker images\s?
conf.dockerimages
(^|[/\w\.]+/)docker search\s?
conf.dockersearch
#(^|[/\w\.]+/)docker pull\s?
#conf.dockerpull
(^|[/\w\.]+/)docker-machine ls\s?
conf.docker-machinels
(^|[/\w\.]+/)docker network ls\s?
conf.dockernetwork
(^|[/\w\.]+/)docker info\s?
conf.dockerinfo
(^|[/\w\.]+/)docker version\s?
conf.dockerversion
------------
# journalctl command
(^|[/\w\.]+/)journalctl?\s
conf.log
# systemctl command
(^|[/\w\.]+/)systemctl?\s
conf.systemctl
# sysctl command
(^|[/\w\.]+/)sysctl?\s
conf.sysctl
# tcpdump command
(^|[/\w\.]+/)tcpdump\s?
conf.tcpdump
# tune2fs command
(^|[/\w\.]+/)tune2fs\s?
conf.tune2fs
# lsmod
(^|[/\w\.]+/)lsmod\s?
conf.lsmod
# lsattr
(^|[/\w\.]+/)lsattr\s?
conf.lsattr
# semanage ---------------------------------
(^|[/\w\.]+/)semanage boolean\s?
conf.semanageboolean
(^|[/\w\.]+/)semanage fcontext\s?
conf.semanagefcontext
(^|[/\w\.]+/)semanage (user|login|port)\s?
conf.semanageuser
# getsebool
(^|[/\w\.]+/)getsebool\s?
conf.getsebool
# ulimit
(^|[/\w\.]+/)ulimit\s?
conf.ulimit
# vmstat
(^|[/\w\.]+/)vmstat\s?
conf.vmstat
# dnf
(^|[/\w\.]+/)dnf\s?
conf.dnf
# nmap
(^|[/\w\.]+/)nmap\s?
conf.nmap
# uptime | w
(^|[/\w\.]+/)(uptime|w)\b
conf.uptime
# getfacl
(^|[/\w\.]+/)getfacl\s?
conf.getfacl
# ntpdate
(^|[/\w\.]+/)ntpdate\s?
conf.ntpdate
# showmount
(^|[/\w\.]+/)showmount\s?
conf.showmount
# apache ant command
(^|[/\w\.]+/)ant\s?
conf.ant
# # apache maven command
(^|[/\w\.]+/)mvn\s?
conf.mvn
# iwconfig command
(^|[/\w\.]+/)iwconfig\s?
conf.iwconfig
# lolcat command
(^|[/\w\.]+/)lolcat\s?
conf.lolcat
# whois
(^|[/\w\.]+/)whois\s?
conf.whois

View File

@ -8,10 +8,10 @@
set -U grc_plugin_execs cat cvs df diff dig gcc g++ ls ifconfig \
make mount mtr netstat ping ps tail traceroute \
wdiff blkid du dnf docker docker-machine env id ip iostat \
wdiff blkid du dnf docker docker-compose docker-machine env id ip iostat journalctl kubectl \
last lsattr lsblk lspci lsmod lsof getfacl getsebool ulimit uptime nmap \
fdisk findmnt free semanage sar ss sysctl systemctl stat showmount \
tcpdump tune2fs vmstat w who
tcpdump tune2fs vmstat w who sockstat
for executable in $grc_plugin_execs
if type -q $executable

View File

@ -1,14 +1,25 @@
# aliases for grc(1)
# this will execute only if there is a line with
# GRC_ALIASES=true
# in /etc/default/grc or you export GRC_ALIASES=true prior to sourcing this
[ -f /etc/default/grc ] && . /etc/default/grc
[ x$GRC_ALIASES = xtrue ] || return 0
GRC="$(which grc)"
if [ "$TERM" != dumb ] && [ -n "$GRC" ]; then
alias colourify="$GRC -es --colour=auto"
if tty -s && [ -n "$TERM" ] && [ "$TERM" != dumb ] && [ -n "$GRC" ]; then
alias colourify="$GRC -es"
alias blkid='colourify blkid'
alias configure='colourify ./configure'
alias df='colourify df'
alias diff='colourify diff'
alias docker='colourify docker'
alias docker-compose='colourify docker-compose'
alias docker-machine='colourify docker-machine'
alias du='colourify du'
alias env='colourify env'
# alias env='colourify env'
alias free='colourify free'
alias fdisk='colourify fdisk'
alias findmnt='colourify findmnt'
@ -20,6 +31,8 @@ if [ "$TERM" != dumb ] && [ -n "$GRC" ]; then
alias iptables='colourify iptables'
alias as='colourify as'
alias gas='colourify gas'
alias journalctl='colourify journalctl'
alias kubectl='colourify kubectl'
alias ld='colourify ld'
#alias ls='colourify ls'
alias lsof='colourify lsof'
@ -27,6 +40,7 @@ if [ "$TERM" != dumb ] && [ -n "$GRC" ]; then
alias lspci='colourify lspci'
alias netstat='colourify netstat'
alias ping='colourify ping'
alias ss='colourify ss'
alias traceroute='colourify traceroute'
alias traceroute6='colourify traceroute6'
alias head='colourify head'
@ -38,5 +52,6 @@ if [ "$TERM" != dumb ] && [ -n "$GRC" ]; then
alias semanage='colourify semanage'
alias getsebool='colourify getsebool'
alias ifconfig='colourify ifconfig'
alias sockstat='colourify sockstat'
fi

131
grc.zsh
View File

@ -1,40 +1,95 @@
if [[ "$TERM" != dumb ]] && (( $+commands[grc] )) ; then
#!/usr/bin/env zsh
# Supported commands
cmds=(
cc \
configure \
cvs \
df \
diff \
dig \
gcc \
gmake \
ifconfig \
last \
ldap \
ls \
make \
mount \
mtr \
netstat \
ping \
ping6 \
ps \
traceroute \
traceroute6 \
wdiff \
whois \
iwconfig \
);
# Set alias for available commands.
for cmd in $cmds ; do
if (( $+commands[$cmd] )) ; then
alias $cmd="grc --colour=auto $(whence $cmd)"
fi
done
# Clean up variables
unset cmds cmd
if ! tty -s || [ ! -n "$TERM" ] || [ "$TERM" = dumb ] || (( ! $+commands[grc] ))
then
return
fi
# Supported commands
cmds=(
as
ant
blkid
cc
configure
curl
cvs
df
diff
dig
dnf
docker
docker-compose
docker-machine
du
env
fdisk
findmnt
free
g++
gas
gcc
getfacl
getsebool
gmake
id
ifconfig
iostat
ip
iptables
iwconfig
journalctl
kubectl
last
ldap
lolcat
ld
ls
lsattr
lsblk
lsmod
lsof
lspci
make
mount
mtr
mvn
netstat
nmap
ntpdate
php
ping
ping6
proftpd
ps
sar
semanage
sensors
showmount
sockstat
ss
stat
sysctl
systemctl
tcpdump
traceroute
traceroute6
tune2fs
ulimit
uptime
vmstat
wdiff
whois
)
# Set alias for available commands.
for cmd in $cmds ; do
if (( $+commands[$cmd] )) ; then
$cmd() {
grc --colour=auto ${commands[$0]} "$@"
}
fi
done
# Clean up variables
unset cmds cmd

44
grcat
View File

@ -4,6 +4,34 @@ from __future__ import print_function
import sys, os, string, re, signal, errno
# redefine readline to pass invalidly encoded characters unchanged, if possible
if hasattr(sys.stdin, 'reconfigure') and hasattr(sys.stdout, 'reconfigure'):
# at least python3.7
sys.stdin.reconfigure(errors='surrogateescape')
sys.stdout.reconfigure(errors='surrogateescape')
myreadline = sys.stdin.readline
myprint = print
else:
if hasattr(sys.stdin, 'buffer'):
# python3
buffer_reader = sys.stdin.buffer
else:
buffer_reader = sys.stdin
def myreadline():
for line in buffer_reader:
try:
decoded = line.decode('utf-8', errors='surrogateescape')
except (UnicodeDecodeError, LookupError):
decoded = line.decode('utf-8', errors='ignore')
return decoded
return ''
def myprint(x):
try:
print(x)
except UnicodeEncodeError:
print(x.encode('utf-8', errors='replace').decode('utf-8'))
#some default definitions
colours = {
'none' : "",
@ -175,9 +203,9 @@ while not is_last:
prevcolour = colours['default']
prevcount = "more"
blockflag = 0
freadline = sys.stdin.readline
while 1:
line = freadline()
line = myreadline()
if line == "" :
break
if line[-1] in '\r\n':
@ -187,14 +215,15 @@ while 1:
for pattern in regexplist:
pos = 0
currcount = pattern['count']
was_replace = 0 # watch replacements, replace regexp only one per line, to avoid infinte loops if the replacement matches the regexp again
while 1:
m = pattern['regexp'](line, pos)
if m:
if 'replace' in pattern:
if was_replace:
break
line = re.sub(m.re, pattern['replace'], line)
#m = pattern['regexp'](line, pos)
#if not m:
# break
was_replace = 1
if 'colours' in pattern:
if currcount == "block":
blockflag = 1
@ -235,7 +264,8 @@ while 1:
skip = pattern['skip'] in ("yes", "1", "true")
if 'colours' not in pattern:
break
else: break
else:
break
if m and currcount == "stop":
prevcount = "stop"
break
@ -273,7 +303,7 @@ while 1:
clineprev = cline[i]
nline = nline + colours['default']
try:
print(nline)
myprint(nline)
except IOError as e:
if e.errno == errno.EPIPE:
break

View File

@ -24,7 +24,7 @@ cp -fv grc.conf $CONFDIR
cp -fv grc.zsh $CONFDIR
cp -fv grc.fish $CONFDIR
mkdir -p $PROFILEDIR
cp -fv grc.bashrc $PROFILEDIR
cp -fv grc.sh $PROFILEDIR
# probably we should not install it into site-functions in a debian package...
if [ "$PREFIX" = "/usr/local" ]; then