diff options
author | Ensa <psychoticfervor@tuta.io> | 2019-12-20 00:14:09 -0800 |
---|---|---|
committer | Ensa <psychoticfervor@tuta.io> | 2019-12-20 00:14:09 -0800 |
commit | 4684d80b6271dd775cd23dabf2b91d6ce56fa33a (patch) | |
tree | ddb6c6219e213132b8500e016b1ce238aa71029d /bin/rsschk | |
parent | f733ca7c8041866df27752c8e0c2610e0ecef6a7 (diff) | |
download | cfg-4684d80b6271dd775cd23dabf2b91d6ce56fa33a.tar.gz |
first significant commit
see README.md for information
Diffstat (limited to 'bin/rsschk')
-rwxr-xr-x | bin/rsschk | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/bin/rsschk b/bin/rsschk new file mode 100755 index 0000000..5a8de6e --- /dev/null +++ b/bin/rsschk @@ -0,0 +1,16 @@ +#!/bin/sh +# checks if $1 is a valid URL, and if so, checks to see if it's in newsboat's urls file, and if not, adds it to the file. +if [ "$1" = "-h" ]; then + printf 'usage: rsschk [-h]|URL [\"category\"]\n'>/dev/stderr&&return 1 +fi +XDG_CONFIG_HOME=${XDG_CONFIG_HOME:=~/.config} +! echo "$1" | grep "http*://\S\+\.[A-Za-z]\+\S*" >/dev/null && + notify-send "Invalid input. rsschk takes http(s) URLs as input." && exit +RSSFILE="$XDG_CONFIG_HOME/newsboat/urls" +if grep -E "^$1" "$RSSFILE"; then + if [ -z "$2" ]; then + echo "$1">>"$RSSFILE"&¬ify-send "RSS feed added." "You may want to edit $RSSFILE now." + else + echo "$1 $2">>"$RSSFILE"&¬ify-send "RSS feed added with one category." + fi +fi |