summaryrefslogtreecommitdiff
path: root/.local/bin/add2rss
diff options
context:
space:
mode:
Diffstat (limited to '.local/bin/add2rss')
-rwxr-xr-x.local/bin/add2rss28
1 files changed, 28 insertions, 0 deletions
diff --git a/.local/bin/add2rss b/.local/bin/add2rss
new file mode 100755
index 0000000..cf9ea73
--- /dev/null
+++ b/.local/bin/add2rss
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+RSSFILE=~/.config/newsboat/urls
+
+if test -n "$1";
+then
+ URL=$1
+elif test ! -t 0;
+then
+ URL=$(cat < /dev/stdin)
+else
+ echo "add2rss: No Input"
+ exit
+fi
+
+if test -n "$2";
+then
+ URL="$URL \"$2\""
+fi
+
+if test -n "$(grep $URL $RSSFILE)";
+then
+ echo "add2rss: You already added this feed"
+else
+ echo "$URL" >> $RSSFILE
+ echo "add2rss: Added"
+fi
+