From 597afdc96409514d5381ffa684d5b573e83a27b9 Mon Sep 17 00:00:00 2001 From: Lance Speelmon Date: Tue, 9 Apr 2013 13:47:31 -0700 Subject: [PATCH] Addressed concerns voiced via code review - thanks --- modules/grc/README.md | 7 ++++--- modules/grc/init.zsh | 13 ++++++------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/modules/grc/README.md b/modules/grc/README.md index 3d933d52..c68007cd 100644 --- a/modules/grc/README.md +++ b/modules/grc/README.md @@ -1,7 +1,8 @@ -grc -=== +Generic Colouriser Module +========================= -Defines grc aliases. +[grc](https://github.com/pengwynn/grc) takes standard input and colourises the output. +Using regular expressions, you can create your own pattern matching colour schemes. Aliases ------- diff --git a/modules/grc/init.zsh b/modules/grc/init.zsh index 50cd899e..693e73f5 100644 --- a/modules/grc/init.zsh +++ b/modules/grc/init.zsh @@ -6,8 +6,7 @@ # # Return if requirements are not found. -# assumes grc was installed in /user/local/bin -if [[ ! -h '/usr/local/bin/grc' ]] || [[ "$TERM" == dumb ]]; then +if (( ! $+commands[grc] )) || [[ $TERM == 'dumb' ]]; then return 1 fi @@ -15,15 +14,15 @@ fi # Aliases # -alias colourify="/usr/local/bin/grc -es --colour=auto" +alias colourify="$commands[grc] -es --colour=auto" alias configure='colourify ./configure' # alias diff='colourify diff' # already color coded with prezto -alias make='colourify make' +alias make="colourify $commands[make]" # alias gcc='colourify gcc' # alias g++='colourify g++' # alias as='colourify as' # alias gas='colourify gas' # alias ld='colourify ld' -alias netstat='colourify netstat' -alias ping='colourify ping' -alias traceroute='colourify /usr/sbin/traceroute' +alias netstat="colourify $commands[netstat]" +alias ping="colourify $commands[ping]" +alias traceroute="colourify $commands[traceroute]"