From c19c96de7e6648388e567174be70476383d352ae Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Mon, 27 Nov 2006 00:33:09 +0000 Subject: allow people to always force colorization #156362 by Benno Schulenberg (Portage version: 2.1.2_rc2-r2) --- sys-apps/less/files/lesspipe.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'sys-apps/less') diff --git a/sys-apps/less/files/lesspipe.sh b/sys-apps/less/files/lesspipe.sh index d1dae0dc2ea9..de11dc5e2c8e 100644 --- a/sys-apps/less/files/lesspipe.sh +++ b/sys-apps/less/files/lesspipe.sh @@ -136,6 +136,7 @@ lesspipe() { # Allow people to flip color off if they dont want it case ${LESSCOLOR} in + always) LESSCOLOR=2;; [yY][eE][sS]|1|true) LESSCOLOR=1;; [nN][oO]|0|false) LESSCOLOR=0;; *) LESSCOLOR=1;; # default to colorize @@ -146,7 +147,12 @@ lesspipe() { exit 0 fi - # Only colorize if we know less will handle raw codes + # Only colorize if user forces it ... + if [[ ${LESSCOLOR} == "2" ]]; then + ${LESSCOLORIZER} "$1" + exit 0 + fi + # ... or we know less will handle raw codes for opt in ${LESS} ; do if [[ ${opt} == "-r" || ${opt} == "-R" ]] ; then ${LESSCOLORIZER} "$1" @@ -187,10 +193,10 @@ if [[ -z $1 ]] ; then echo "Usage: lesspipe.sh " elif [[ $1 == "-V" ]] ; then Id="cvsid" - cvsid="$Id: lesspipe.sh,v 1.19 2006/11/05 21:58:50 vapier Exp $" + cvsid="$Id: lesspipe.sh,v 1.20 2006/11/27 00:33:09 vapier Exp $" cat <<-EOF $cvsid - Copyright 2001-2005 Gentoo Foundation + Copyright 2001-2006 Gentoo Foundation Mike Frysinger (with plenty of ideas stolen from other projects/distros) -- cgit v1.2.3-65-gdbad