├── LICENSE
├── README.md
├── conf.d
├── executables
└── grc.fish
└── functions
└── grc.wrap.fish
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2014 Bruno Ferreira Pinto
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | [![][travis-badge]][travis-link]
2 | ![][license-badge]
3 |
4 |
9 |
10 |
11 | # plugin-grc
12 |
13 | A [grc][grc] plugin plugin for [Oh My Fish][omf-link].
14 |
15 | > Note: You need to have grc installed
16 |
17 | ![screenshot][screenshot]
18 |
19 | ## Install
20 |
21 | ```fish
22 | $ omf install grc
23 | ```
24 |
25 | ## Built-in command colorizers
26 |
27 | Everyone supported by the original [grc](grc) tool. If there are tools that are
28 | missing add them to the executables file and make a pull-request for it
29 |
30 | Among others, it includes the following:
31 |
32 | - `cat`
33 | - `cvs`
34 | - `df`
35 | - `diff`
36 | - `dig`
37 | - `gcc`
38 | - `g++`
39 | - `ifconfig`
40 | - `ls`
41 | - `make`
42 | - `mount`
43 | - `mtr`
44 | - `netstat`
45 | - `ping`
46 | - `ps`
47 | - `tail`
48 | - `traceroute`
49 | - `wdiff`
50 |
51 | ## Plugin options
52 |
53 | It's possible to define additional command options via universal `grcplugin`
54 | variables. For example:
55 |
56 | ```fish
57 | set -U grcplugin_ls --color -l
58 | ```
59 |
60 | Makes `grc` call `ls` with `--color` and `-l` options.
61 |
62 | ### Override command colorizers
63 |
64 | It's possible to override the commands that are colorized via `grc_plugin_execs`
65 | variable. For example:
66 |
67 | ```fish
68 | set -U grc_plugin_execs gcc g++ make
69 | ```
70 |
71 | Enables `grc` colorizing for only `gcc`, `g++` & `make` and disables all others.
72 |
73 | ### Ignore specific executables
74 |
75 | Alternatively, you can specify commands that the plugin *should not* override.
76 | You can do that via the `grc_plugin_ignore_execs` variable:
77 |
78 | ```fish
79 | set -U grc_plugin_ignore_execs ls
80 | ```
81 |
82 | ### Specify custom executables
83 |
84 | If you have custom executables that should be wrapped with `grc` specify them in
85 | `grc_plugin_extras`:
86 |
87 | ```fish
88 | set -U grc_plugin_extras my_custom_executable
89 | ```
90 |
91 | # License
92 |
93 | [MIT][mit] © [oh-my-fish][author] et [al][contributors]
94 |
95 |
96 | [mit]: http://opensource.org/licenses/MIT
97 | [author]: http://github.com/oh-my-fish
98 | [contributors]: https://github.com/oh-my-fish/pkg-plugin-grc/graphs/contributors
99 | [omf-link]: https://www.github.com/oh-my-fish/oh-my-fish
100 |
101 | [license-badge]: https://img.shields.io/badge/license-MIT-007EC7.svg?style=flat-square
102 | [travis-badge]: http://img.shields.io/travis/oh-my-fish/plugin-grc.svg?style=flat-square
103 | [travis-link]: https://travis-ci.org/oh-my-fish/plugin-grc
104 | [grc]: http://kassiopeia.juls.savba.sk/~garabik/software/grc.html
105 | [screenshot]: https://raw.githubusercontent.com/tannhuber/media/master/grc-plugin.png
106 |
107 |
108 |
--------------------------------------------------------------------------------
/conf.d/executables:
--------------------------------------------------------------------------------
1 | whois
2 | wdiff
3 | vmstat
4 | uptime
5 | ulimit
6 | tune2fs
7 | traceroute
8 | tcpdump
9 | systemctl
10 | sysctl
11 | stat
12 | ss
13 | sql
14 | showmount
15 | sensors
16 | semanageuser
17 | semanagefcontext
18 | semanageboolean
19 | pv
20 | ps
21 | proftpd
22 | ping2
23 | ping
24 | php
25 | ntpdate
26 | nmap
27 | netstat
28 | mvn
29 | mtr
30 | mount
31 | lspci
32 | lsof
33 | lsmod
34 | lsblk
35 | lsattr
36 | ls
37 | lolcat
38 | log
39 | ldap
40 | last
41 | iwconfig
42 | irclog
43 | iptables
44 | iproute
45 | ipneighbor
46 | ipaddr
47 | ip
48 | iostat_sar
49 | ifconfig
50 | id
51 | getsebool
52 | getfacl
53 | gcc
54 | free
55 | findmnt
56 | fdisk
57 | esperanto
58 | env
59 | du
60 | dockerversion
61 | dockersearch
62 | dockerpull
63 | dockerps
64 | dockernetwork
65 | docker-machinels
66 | dockerinfo
67 | dockerimages
68 | dnf
69 | dig
70 | diff
71 | df
72 | cvs
73 | configure
74 | blkid
75 | ant
76 |
--------------------------------------------------------------------------------
/conf.d/grc.fish:
--------------------------------------------------------------------------------
1 | if type -q grc
2 | set executables_path (dirname (realpath (status --current-filename)))/executables
3 |
4 | set -l execs (cat $executables_path)
5 |
6 | # remove the execs in the ignore_execs list
7 | if set -q grc_plugin_ignore_execs
8 | for ignore_exec in $grc_plugin_ignore_execs
9 | set -l index (contains -i -- $ignore_exec $execs)
10 | if set -q index[1]
11 | set --erase execs[$index]
12 | end
13 | end
14 | end
15 |
16 | # user has given an absolute list of plugins - just use that
17 | if set -q grc_plugin_execs
18 | if set -q grc_plugin_ignore_execs
19 | echo "Both grc_plugin_execs and grc_plugin_ignore_execs have been provided. Ignoring the latter."
20 | set execs $grc_plugin_execs
21 | end
22 | end
23 |
24 | if set -q grc_plugin_extras
25 | set -a execs $grc_plugin_extras
26 | end
27 |
28 | for executable in $execs
29 | if type -q $executable
30 | function $executable --inherit-variable executable --wraps=$executable
31 | grc.wrap $executable $argv
32 | end
33 | end
34 | end
35 | else
36 | echo 'You need to install grc!'
37 | end
38 |
--------------------------------------------------------------------------------
/functions/grc.wrap.fish:
--------------------------------------------------------------------------------
1 | function grc.wrap -a executable
2 | set executable $argv[1]
3 |
4 | if test (count $argv) -gt 1
5 | set arguments $argv[2..(count $argv)]
6 | else
7 | set arguments
8 | end
9 |
10 | set optionsvariable "grcplugin_"$executable
11 | set options $$optionsvariable
12 |
13 | command grc -es --colour=auto $executable $options $arguments
14 | end
15 |
--------------------------------------------------------------------------------