[download]

local/bin/news-menu

   1 #!/bin/bash
   2 
   3 db(){ sqlite3 -separator $'\t' ~/.newsboat/cache.db "$@"; }
   4 
   5 s=$(db '
   6     select unread, rss_feed.title, rss_item.title, rss_item.url
   7     from rss_item join rss_feed on rssurl = feedurl
   8     order by unread desc, pubDate desc limit 500
   9 ' | while read i; do
  10     [[ $i == 0* ]] && echo "   ${i:1}"
  11     [[ $i == 1* ]] && icon news-"$i" "${i:1}"
  12 done | column -ts $'\t' | menu -i news -l 15 |
  13 awk '{ print "\"" $NF "\"" }' | paste -sd ,)
  14 
  15 [[ $s ]] || exit
  16 db "update rss_item set unread = 0 where url in ($s)"
  17 chromium $(db "select url from rss_item where url in ($s)") &