commit e4ac4dfa16c8dbfd26b4c6e30de4d0bd136773ca parent 2c71d0c570e6273fbc1a8499d1f8598a8056f406 Author: Jacob R. Edwards <n/a> Date: Fri, 2 Dec 2022 19:48:40 -0600 Add sfeed_curses wrapper which adds a configuration file It uses a sed script to delete comments, verify, and provide $HOME substitution, then simply passes each line as an argument to env(1), which calls sfeed_curses(1). It also automatically runs it on the feeds in the feed directory specified by sfeedpath (see sfeedrc(5)) if no arguments are given. (You must run it on /dev/stdin to read from stdin.) Diffstat:
| A | local/bin/bin/sfeed_curses | | | 27 | +++++++++++++++++++++++++++ |
1 file changed, 27 insertions(+), 0 deletions(-)
diff --git a/local/bin/bin/sfeed_curses b/local/bin/bin/sfeed_curses @@ -0,0 +1,27 @@ +#!/bin/sh +# Copyright 2022 Jacob R. Edwards +# Allow configuration file for sfeed_curses + +IFS=' +' + +getargs() sed '/[ ]*#/d +s/[ ]+#.*// +/=/ ! { + i\ +sh\ +-c\ +echo "Invalid sfeed_curses config (not an assignment)" 1>&2; exit 1\ + + q +} +s!\$HOME!'"$HOME"'!g' "$@" + +rc="$HOME"/.sfeed/sfeed_cursesrc +s="$(whereis sfeed_curses)" + +test $# -eq 0 && + set -- ${sfeedpath:-"$HOME"/.sfeed/feeds}/* +test -f "$rc" && + exec env $(getargs "$rc") "$s" "$@" +exec "$s" "$@"