dotfiles

configuration files
git clone https://pi.duncano.de/git/dotfiles.git
Log | Files | Refs | README

commit 5eafdce461abbc8f1d34fd0d530c08bb883b5bc1
parent 1b46c312bf8f740721634869b35a210567946494
Author: Duncaen <mail@duncano.de>
Date:   Mon, 13 Feb 2017 01:28:10 +0100

bin/yiff: import Ypnoses awk version

Diffstat:
bin/yiff | 28++++++++++++++++------------
1 file changed, 16 insertions(+), 12 deletions(-)

diff --git a/bin/yiff b/bin/yiff @@ -1,14 +1,18 @@ -#!/usr/bin/mksh +#!/usr/bin/awk -f +# yiff - colored diff # Script by Ypnose - http://ywstd.fr -while IFS=$'\n' read -r LINE; do - CHAR="${LINE::1}" - case $CHAR in - \-) print -- "\033[1;31m${LINE}\033[0m" ;; - \+) print -- "\033[0;32m${LINE}\033[0m" ;; - \@) print -- "\033[1;35m${LINE}\033[0m" ;; - *) print -- "$LINE" ;; - esac -done - -exit +BEGIN { FS="\n" } +symb = substr($0,1,1) { + # Highlight end line space(s)/tab(s) + gsub(/[\t ]+$/,"\033[0;41m \033[0m") + if (symb == "@") { + printf("\033[1;35m%s\033[0m\n", $0) + } else if (symb == "-") { + printf("\033[0;31m%s\033[0m\n", $0) + } else if (symb == "+") { + printf("\033[0;32m%s\033[0m\n", $0) + } else { + printf("%s\n", $0) + } +}