commit bcfb257516e0329a86b9c344e0885f49b28065dd parent 94fa96f0c4e52bfb552cccacea2d0781c1226994 Author: Jacob R. Edwards <jacobouno@protonmail.com> Date: Mon, 15 Feb 2021 17:16:46 -0800 Add upfeed, A simple sfeed(1) updating script Since sfeed_update(1) is overly complex and doesn't store it's rc file in XDG_CONFIG_HOME I made a simple one myself. Diffstat:
| A | modules/scripts/.local/bin/upfeed | | | 28 | ++++++++++++++++++++++++++++ |
1 file changed, 28 insertions(+), 0 deletions(-)
diff --git a/modules/scripts/.local/bin/upfeed b/modules/scripts/.local/bin/upfeed @@ -0,0 +1,28 @@ +#!/bin/sh +# Copyright 2020 Jacob R. Edwards +# License: GPLv3 +# +# upfeed -- update feeds +# +# The upfeed script fetches each feed, processes it with sfeed(1), +# and writes it to `$FEED_DIR/$name'. If arguments given they are +# taken as configuration files, otherwise feeds are read from +# `$XDG_CONFIG_HOME/upfeedrc'. Configuration files may contain blank +# lines or comments (`#') and are of the format `<name>[ \t]+<url>'. + +rc="${XDG_CONFIG_HOME:-$HOME/.config}/upfeedrc" + +update() { + test $# -eq 2 || { + echo 'upfeed: update: Invalid number of arguments.' 1>&2 + exit 1 + } + curl -Ss "$2" | sfeed >"${FEED_DIR:-.}/$1" + echo "$1" +} + +egrep -ve '^#' -e '^$' "${@:-$rc}" | while read feed +do + update $feed & +done +wait