about summary refs log tree commit diff stats
path: root/bin/rsschk
diff options
context:
space:
mode:
authorensa <psii@riseup.net>2020-06-29 19:45:18 -0700
committerensa <psii@riseup.net>2020-06-29 19:45:18 -0700
commite1d03e2fe607c5e1643be186c4ce4031ae1004e0 (patch)
treeee249107b5fb051f8d11e6c87e2e5e19775c5daa /bin/rsschk
parenta11f7c357236afea1b00df5f85dc8674f5f1d661 (diff)
downloadcfg-e1d03e2fe607c5e1643be186c4ce4031ae1004e0.tar.gz
bin/fl added, lh reworked, opener renamed, data/applications removed
bin/
	fl: finds links, sends list to dmenu so user can choose one to copy to the
	clipboard
	lh:
		replaced sed invocations with lstrip() invocations
		redir handling changed to function findredir(), which loops over curl's
		output, only outputting location urls
		changed case statement to look for .extensions instead of the end of the url
		local files are now sent to bin/op for processing
		mpv given --no-terminal flag for no output instead of redirection shit
		similarly, sxiv is given -q (and -p to not cache)
	op:
		formerly opener
		changed error message to be more portable
	prompt:
		removed help text
	pw:
		doesn't need to be in a variable
	rsschk:
		redesigned after an eternity
		uses a modified re_urls, looking for .rss and .xml urls
		generally smaller
	shenv:
		uses ${var:=val}
		specifies /bin/sh
	xbg:
		removed .fehbg handling
config/
	aliasrc:
		e and v set TERM to xterm-256color, otherwise vis freaks out
	cwmrc:
		urgencyborder color added (with color1)
		ungroupborder changed to color5
		program list removed
		4-Return set to $TERMINAL
		4S-r rebound to restart
		4-X set to $LOCK
		prompt binds fixed
	dunst/dunstrc:
		icons disabled
	ksh/functions/l.:
		changed to ksh function
		for non-current directories, changes there in a subshell and uses that
		current directory, sending an error message if the directory doesn't exist
	lf/lfrc:
		cmd open removed
		cmd ttmsh fixed
	shrc:
		removed ALTSCR
		added OPENER=op
		IRC_SERVERS_FILE removed
		TODO changed to correct path
		GOCACHE and GOBIN added, self-explanatory
data/
	applications/:
		removed
	mailcap:
		changed to relegate most of its functionality to bin/op
Diffstat (limited to 'bin/rsschk')
-rwxr-xr-xbin/rsschk21
1 files changed, 10 insertions, 11 deletions
diff --git a/bin/rsschk b/bin/rsschk
index 5a8de6e..ab74169 100755
--- a/bin/rsschk
+++ b/bin/rsschk
@@ -1,16 +1,15 @@
 #!/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.
+# checks if $1 is a valid URL
+# if so, checks to see if it's in newsboat's urls file
+# 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 &&
+# regex for finding urls
+re_urls='https?://[[:alnum:].]*:?[[:alnum:]./@$&%?$#=_-]*\.(rss|xml)'
+
+! echo "$1" | grep -Eq "$re_urls" &&
 	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"&&notify-send "RSS feed added." "You may want to edit $RSSFILE now."
-	else
-		echo "$1 $2">>"$RSSFILE"&&notify-send "RSS feed added with one category."
-	fi
-fi
+RSSFILE="${XDG_CONFIG_HOME:=~/.config}/newsboat/urls"
+grep -q "^$1" "$RSSFILE" &&
+	{ echo "$1">>"$RSSFILE"&&notify-send "RSS feed added.";}