cw
cw copied to clipboard
Colorizing wrapper generator for shell commands, with many pre-defined wrappers
cw
--
(c) 2013-2020 Reuben Thomas <[email protected]>
(c) 2004-2010 v9/fakehalo <[email protected]>
http://github.com/rrthomas/cw/
cw is a colorer for command-line programs. It is designed to be transparent: when you type 'du', 'df', 'ping', etc. in your shell the output is automatically colored according to a definition script, but when the commands are used non-interactively (e.g. in another script) their output is not colored, so as not to confuse programs that process their output. Text patterns are defined as lexical classes, and assigned colors. The arguments to the original program and OS under which it is running can be tested. cw includes over 50 definition scripts, and it's easy to write more.
cw is distributed under the GNU General Public License version 3, or, at your option, any later version. This is free software: you are free to change and redistribute it. There is NO warranty, to the extent permitted by law.
Installation
Install cw using LuaRocks from http://www.luarocks.org/ :
luarocks install cw
To use cw, you need to prepend its definition directory to the PATH environment variable. You should do this in your shell's interactive startup file (you don't want cw being run by background commands). For example, for bash and other Bourne-compatible shells, add the following line to your ~/.bashrc:
if [ -n "$PS1" ]; then PATH=cw-definitions-path
:$PATH; export PATH; fi
The test of $PS1 ensures that the shell is really interactive.
Use
Start a new shell and try some commands, which should now be colored! See cw(1) (the cw man page) for more information, including details of definition scripts.
Alternatives to cw
cw doesn't try to replace some dedicated coloring wrappers and programs, such as:
ccal: http://unicorn.us.com/cal.html colorgcc: http://schlueters.de/colorgcc.html colordiff: http://www.colordiff.org/ colormake: https://github.com/pagekite/Colormake freecolor: http://www.rkeene.org/oss/freecolor/
There are also other programs like cw that you may prefer:
Crayonizer: https://sites.google.com/site/columscode/home/crayonizer acoc: http://www.caliban.org/ruby/acoc.shtml