config

OpenBSD system configuration
git clone git://jacobedwards.org/config
Log | Files | Refs | README

commit ff11843c84a42ed946bd6fc6f713358dcdf8d171
parent 82a86409eca0c801b5b3b13e3320c849822283e6
Author: Jacob R. Edwards <jacobouno@protonmail.com>
Date:   Mon, 31 Aug 2020 23:41:21 -0700

Fix bugs and change flags

fix possable bugs where a new fields are created by awk gsub.

change some flags.

Diffstat:
Mscripts/.local/bin/feed | 21+++++++++------------
1 file changed, 9 insertions(+), 12 deletions(-)

diff --git a/scripts/.local/bin/feed b/scripts/.local/bin/feed @@ -2,27 +2,24 @@ # manage viewing text/html rss feeds formatted by sfeed(1) in RSSTEXT # directory. -# options: -# default: match whole item -# -f, list feed files -# -l, list feeds with sfeed_plain -# -n, get nth feed -# -t, get title matches +set -e -# format "title<tab>content<newline>" text. +# this function is getting out of hand, going to rewrite this program in C soon +# as I find I like it. ffmt() { - awk -F'\t' '{ gsub(/\\t/, "\t", $0); gsub(/\\n+/, "<p>", $0); \ - printf "<h1>%s</h1>%s\n", $1, $2 }' | html2text -style pretty + awk -F'\n' '{ gsub("\t", "\n", $0) \ + gsub(/\\t/, "\t", $0); gsub(/\\n/, " ", $0); \ + printf "<h1>%s</h1><article>%s</article>\n", $1, $2 }' } set -e case $1 in - -h) echo "usage: `basename $0` -h | -f | -l | -n index | -t regex | regex | [file]";; - -f) ls -1 $RSSTEXT;; - -l) cut -f2 $RSSTEXT/${2:-*};; + -h) echo "usage: `basename $0` -h | -l | -d | -n index | -t regex | regex | [file]";; + -l) ls -1 $RSSTEXT;; + -d) cut -f2 $RSSTEXT/${2:-*};; -n) cat $RSSTEXT/${3:-*} | head -n "$2" | tail -1 | cut -f2,4 | ffmt;; -t) awk -vOFS="\t" -vFS="\t" "match(tolower(\$2), \"$2\") > 0 \ { print \$2, \$4 }" $RSSTEXT/${3:-*} | ffmt;;