From 49f6fc03a42e7b875f691f7476e956923f731a62 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Sat, 6 Feb 2021 14:04:44 -0600 Subject: Rename to shatom --- README.md | 10 ++-- gemshimfeed | 164 ------------------------------------------------------------ shatom | 164 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 169 insertions(+), 169 deletions(-) delete mode 100755 gemshimfeed create mode 100755 shatom diff --git a/README.md b/README.md index c2c1bc6..92ab758 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ -# gemshimfeed +# shatom ## an Atom feed generator in (mostly) POSIX shell Because of [this post in the Gemini mailing list](https://lists.orbitalfox.eu/archives/gemini/2020/003407.html), which bemoans the inability to generate Atom feeds using bare-bones computers, -I present `gemshimfeed`, a shell program that purports to do just that. +I present `shatom`, a shell program that purports to do just that. It has minimal dependencies (see DEPENDENCIES, below), and is completely modifiable by the user with the config file @@ -25,12 +25,12 @@ you're writing another script. ## CONFIG -All of the functions and variables defined in `gemshimfeed` +All of the functions and variables defined in `shatom` can be overwritten by a config file, by default -`gemshimfeed.conf.sh` in the current directory. +`shatom.conf.sh` in the current directory. As may be obvious from the file's extension, it's a shell script, so you can redefine (and in fact, *should* redefine) -all the variables and functions in `gemshimfeed` to suit your needs. +all the variables and functions in `shatom` to suit your needs. Here's a convenient list: diff --git a/gemshimfeed b/gemshimfeed deleted file mode 100755 index 3025182..0000000 --- a/gemshimfeed +++ /dev/null @@ -1,164 +0,0 @@ -#!/bin/sh -# generate a Atom feed from a directory, recursively -# using POSIX sh -# AUTHOR: Case Duckworth -# LICENSE: MIT - -usage() { - cat < - -$FEED_TITLE -$FEED_SUBTITLE - - -$FEED_ID -GemShimFeed -$FEED_COPYRIGHT -$FEED_UPDATED -END -} - -atom_footer() { - cat < -END -} - -atom_entry() { # atom_entry FILE - ENTRY_URL="$(entry_url "$1")" - ENTRY_TITLE="$(entry_title "$1")" - ENTRY_SUMMARY="$(entry_summary "$1")" - ENTRY_AUTHOR="$(entry_author "$1")" - ENTRY_CONTENT="$(entry_content "$1")" - ENTRY_UPDATED="$(entry_updated "$1")" - cat < -$ENTRY_URL - -$ENTRY_TITLE -$ENTRY_SUMMARY -$ENTRY_UPDATED -$ENTRY_AUTHOR - - -END -} - -main() { - CONFIGFILE="$PWD/gemshimfeed.conf.sh" - case "$1" in - -h) - usage - exit 0 - ;; - -c) - CONFIGFILE="$2" - shift 2 - ;; - esac - - if [ -f "CONFIGFILE" ]; then - . "$CONFIGFILE" - fi - - atom_header - for DIR; do - for entry in $(recent_files "$DIR" -type f); do - if skip_entry "$entry"; then continue; fi - - atom_entry "$entry" - done - done - atom_footer -} - -if [ $DEBUG ]; then set -x; fi - -main "$@" diff --git a/shatom b/shatom new file mode 100755 index 0000000..48b99ff --- /dev/null +++ b/shatom @@ -0,0 +1,164 @@ +#!/bin/sh +# generate a Atom feed from a directory, recursively +# using POSIX sh +# AUTHOR: Case Duckworth +# LICENSE: MIT + +usage() { + cat < + +$FEED_TITLE +$FEED_SUBTITLE + + +$FEED_ID +shatom +$FEED_COPYRIGHT +$FEED_UPDATED +END +} + +atom_footer() { + cat < +END +} + +atom_entry() { # atom_entry FILE + ENTRY_URL="$(entry_url "$1")" + ENTRY_TITLE="$(entry_title "$1")" + ENTRY_SUMMARY="$(entry_summary "$1")" + ENTRY_AUTHOR="$(entry_author "$1")" + ENTRY_CONTENT="$(entry_content "$1")" + ENTRY_UPDATED="$(entry_updated "$1")" + cat < +$ENTRY_URL + +$ENTRY_TITLE +$ENTRY_SUMMARY +$ENTRY_UPDATED +$ENTRY_AUTHOR + + +END +} + +main() { + CONFIGFILE="$PWD/$0.conf.sh" + case "$1" in + -h) + usage + exit 0 + ;; + -c) + CONFIGFILE="$2" + shift 2 + ;; + esac + + if [ -f "CONFIGFILE" ]; then + . "$CONFIGFILE" + fi + + atom_header + for DIR; do + for entry in $(recent_files "$DIR" -type f); do + if skip_entry "$entry"; then continue; fi + + atom_entry "$entry" + done + done + atom_footer +} + +if [ $DEBUG ]; then set -x; fi + +main "$@" -- cgit 1.4.1-21-gabe81