From 899ba881a6d24216a1a56356f459912a1c5b9906 Mon Sep 17 00:00:00 2001 From: Les De Ridder Date: Sun, 24 Mar 2019 09:53:45 +0100 Subject: [PATCH] Highlight search keywords in results --- saury | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/saury b/saury index 30bfbef..d546f7e 100755 --- a/saury +++ b/saury @@ -102,7 +102,12 @@ function aur_search set_color --bold echo -n (string join "" \ (set_color CC3399) "aur/" \ - (set_color normal; set_color --bold) "$name") + (set_color normal; set_color --bold) (string replace -a -i \ + "$query" \ + (string join "" (set_color 33CCB3) \ + "$query" \ + (set_color normal; set_color --bold)) \ + "$name")) echo -n ' ' if test $out_of_date = "true" @@ -144,7 +149,12 @@ function aur_search echo set_color normal - echo " $description" + echo (string replace -a -i \ + "$query" \ + (string join "" (set_color 33CCB3) \ + "$query" \ + (set_color normal)) \ + " $description") end else if test "$rpc_response_type" = "error" set rpc_error (echo $rpc_response | jq -r '.error')