From: Nicolas Boisselier Date: Mon, 19 Jan 2026 09:16:58 +0000 (+0100) Subject: etc/profile.d/functions hl() X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=d9f055ce925ff9dc59eab8b9b8c2df03a73a7fd5;p=nb.git etc/profile.d/functions hl() --- diff --git a/etc/profile.d/functions b/etc/profile.d/functions index 6a7c6fbe..9c23e5c5 100755 --- a/etc/profile.d/functions +++ b/etc/profile.d/functions @@ -332,7 +332,13 @@ json2perl() { hl(){ #cat | grep --color=always -E "(^|($@))" - perl -MTerm::ANSIColor -pe 'BEGIN{$|=1;}; $e=qq@'"$@"'@;$e=~s,/,\\/,g; s/($e)/color("red").$1.color("reset")/ge' + local color=red + if [ "$1" = "-color" ]; then + shift + color=$1 + shift + fi + perl -MTerm::ANSIColor -pe 'BEGIN{$|=1;}; $e=qq@'"$@"'@;$e=~s,/,\\/,g; s/($e)/color("'$color'").$1.color("reset")/ge' } ls_tree() {