summaryrefslogtreecommitdiff
path: root/.local/bin/add2rss
blob: ab2936238a97b8bc71cdb43bc9ee6a55994b4e04 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/sh

RSSFILE=~/.config/newsboat/urls

if test -n "$1";
then
	URL=$1
elif test ! -t 0;
then
	URL=$(cat < /dev/stdin)
else
	URL=$(xclip -o clipboard)
	if test -n "$URL";
	then
		notify-send "add2rss: copied $URL from clipboard"
	else
		notify-send "add2rss: no input"
		exit
	fi
fi

if test -n "$2";
then
	URL="$URL \"$2\""
fi

if test -n "$(grep $URL $RSSFILE)";
then
	notify-send "add2rss: You already added this feed"
else
	echo "$URL" >> $RSSFILE
	notify-send "add2rss: Added"
fi