commit 4f8129242c62f158c117e2ebf68acc40aff6166f
parent 3d2cd7cf4a4052f3db6e13af4f22835b457bdeb3
Author: GeaRSiX <gearsix@tuta.io>
Date: Thu, 18 Jun 2020 11:42:47 +0100
added sfeed-read command
Diffstat:
3 files changed, 94 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
@@ -29,7 +29,8 @@ BIN = \
sfeed_xmlenc
SCRIPTS = \
sfeed_opml_export\
- sfeed_update
+ sfeed_update\
+ sfeed-read
SRC = ${BIN:=.c}
HDR = \
diff --git a/sfeed-read b/sfeed-read
@@ -0,0 +1,56 @@
+#!/bin/sh
+
+# sfeed-read
+# author: gearsix
+# description: sfeed_update; backup outfile; generates outifle; xdg-open outfile;
+
+engine=sfeed_html
+sfeed_files=~/.sfeed/feeds
+sfeed_outdir=~/docs/sfeed
+sfeed_outfile=~/docs/sfeed/feed
+
+if [ ! -z $1 ]; then
+ case "$1" in
+ "html" | "HTML" | "sfeed_html")
+ ;;
+ "atom" | "Atom" | "sfeed_atom")
+ engine=sfeed_atom
+ sfeed_outfile=$sfeed_outfile.atom
+ ;;
+ "plain" | "Plain" | "plain-text" | "Plain-Text" | "plain-text" | "sfeed_plain")
+ engine=sfeed_plain
+ sfeed_outfile=$sfeed_outfile.txt
+ ;;
+ "mbox" | "mail" | "mailbox")
+ engine=sfeed_mbox
+ ;;
+ "twtxt")
+ engine=sfeed_twtxt
+ sfeed_outfile=$sfeed_outfile.txt
+ ;;
+ "gopher")
+ engine=sfeed_gopher
+ sfeed_outfile=$sfeed_outfile.gopher
+ ;;
+ *)
+ echo "unrecognised engine, please select from $(/usr/local/bin/sfeed*)"
+ ;;
+ esac
+else
+ sfeed_outfile=$sfeed_outfile.html
+fi
+
+echo "updating feed..."
+sfeed_update
+
+echo "backing up feed..."
+rm $sfeed_outfile.yesterday
+mv -v $sfeed_outfile $sfeed_outfile.yesterday
+
+echo "generating $sfeed_outfile..."
+$engine $sfeed_files/* > $sfeed_outfile$outext
+
+echo "opening $sfeed_outfile..."
+xdg-open "$sfeed_outfile"
+
+echo "done"
diff --git a/sfeed-read.1 b/sfeed-read.1
@@ -0,0 +1,36 @@
+.Dd June 18, 2020
+
+.Dt SFEED-READ 1
+
+.Sh NAME
+.Nm sfeed-read
+.Nd update & read feed
+.Op Ar $sfeed_outfile
+
+.Sh SYNOPSIS
+.Nm
+.Op Ar sfeedrc
+
+.Sh DESCRIPTION
+.Bd -literal
+1. update the feed using sfeed_update
+2. backup any existing $sfeed_outfile to $sfeed_outfile.yesterday
+3. regenerate $sfeed_outfile; xdg-open $sfeed_outfile
+
+.Sh DEFAULTS
+.Bl -tag -width 12n
+.It Ar sfeed_outfile
+Directory of all your feeds (generated by sfeed_update)
+.Pa ~/.sfeed/feeds
+.It Ar sfeed_outfile
+The file output sfeed results to
+.Pa ~/docs/sfeed/feeds
+.It Ar sfeed_outdir
+The directory of $outputfile
+.Pa ~/docs/sfeed
+
+.Sh ARGUMENTS
+.It $1
+Specify the output sfeed_* tool to use; defaults to sfeed_html.
+
+.Os Unix; BSD