From d9f055ce925ff9dc59eab8b9b8c2df03a73a7fd5 Mon Sep 17 00:00:00 2001 From: Nicolas Boisselier Date: Mon, 19 Jan 2026 10:16:58 +0100 Subject: [PATCH] etc/profile.d/functions hl() --- etc/profile.d/functions | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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() { -- 2.47.3