aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorV.Krishn <vkrishn4@gmail.com>2021-11-27 05:22:58 +0530
committerV.Krishn <vkrishn4@gmail.com>2021-11-27 05:22:58 +0530
commite02f08b62d4579753878555d8708c596370c52c4 (patch)
treedda55aeacf6bf7c93ff6b791400cef1935f053d9
parent1bec958fc1a1e8ec5f0a5635779786025a313dd7 (diff)
downloadnbreader-e02f08b62d4579753878555d8708c596370c52c4.tar.bz2
add color to search (opt), code clean
-rw-r--r--scripts/feedicon.sh6
-rw-r--r--scripts/fetch.sh2
-rw-r--r--scripts/search.sh15
3 files changed, 18 insertions, 5 deletions
diff --git a/scripts/feedicon.sh b/scripts/feedicon.sh
index 085acf6..39a423d 100644
--- a/scripts/feedicon.sh
+++ b/scripts/feedicon.sh
@@ -203,7 +203,7 @@ update_feedicon() {
local iconfile="$ICONTXTDIR/$a/$b/$URLSUM.ico.txt"
if [ -f "$iconfile" ]; then
- printf "${cGREEN}Nothing to do !! icon already downloaded${cNORMAL} -> $URLSUM\n";
+ printf "${cGREEN}Nothing done ! icon already downloaded${cNORMAL} -> $URLSUM\n";
return;
fi
@@ -211,13 +211,13 @@ update_feedicon() {
query="SELECT dbname FROM rss_url WHERE sha1sum='$URLSUM';";
local dbname=$(echo "$query" | sqlite3 "$CONFIGDIR/urls.db");
if [ ! $dbname ]; then
- printf "${cRED}Nothing to do !! (no record found)${cNORMAL}\n";
+ printf "${cRED}Nothing done !! (no record found)${cNORMAL}\n";
return;
fi
get_siteurl_from_db $dbname $URLSUM
if [ ! $rssurl ]; then
- printf "${cRED}Nothing to do !! (no rss file)${cNORMAL}\n";
+ printf "${cRED}Nothing done !! (no rss file)${cNORMAL}\n";
return;
fi
get_feedicon $rssurl
diff --git a/scripts/fetch.sh b/scripts/fetch.sh
index c1a1b4a..eb2bab3 100644
--- a/scripts/fetch.sh
+++ b/scripts/fetch.sh
@@ -144,7 +144,7 @@ fetch_url() {
_fetch_querylist() {
local s=$1; local epoch=$2;
if [ ! "$s" ]; then
- printf "${cRED}Nothing to do !! (no record found)${cNORMAL}\n";
+ printf "${cRED}Nothing done ! (no record found)${cNORMAL}\n";
return;
fi
diff --git a/scripts/search.sh b/scripts/search.sh
index 76151b0..bf01126 100644
--- a/scripts/search.sh
+++ b/scripts/search.sh
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# Copyright (c) 2015-2020 V.Krishn
+# Copyright (c) 2015-2021 V.Krishn
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the Simplified BSD License (also
@@ -98,6 +98,19 @@ searchall() {
";
}
+# add color to search output
+searchallc() {
+ local tmpf='/tmp/nbreader.search.txt'
+ searchall > $tmpf
+ echo -e $cYELLOW
+ cat $tmpf | while read l; do
+ l2=$(echo $l | sed -E "s#(\|http.*$)#\\${cGREEN}\1\\${cNORMAL}#" \
+ | sed -E "s#^(.*\|[12]\|)#\\${cRED}\1\\${cNORMAL}#");
+ echo -e $l2
+ done
+ echo ""
+}
+
searchall