commit a453a0693ff2008f1485d6bbc480bd7eb88b2012 parent e64e0456b54dd32bf787e6afe5d241e2c0aff4de Author: Alex Balgavy <a.balgavy@gmail.com> Date: Thu, 2 Jul 2020 18:57:41 +0200 newsrefreshd: a script to refresh newsboat (e.g. in a cronjob) Former-commit-id: 7cead968082d58515d14682ef72f4ac33bbfb303 Diffstat:
A | scripts/newsrefreshd | | | 20 | ++++++++++++++++++++ |
1 file changed, 20 insertions(+), 0 deletions(-)
diff --git a/scripts/newsrefreshd b/scripts/newsrefreshd @@ -0,0 +1,20 @@ +#!/bin/sh +set -e + +alias git=/usr/local/bin/git +alias newsboat=/usr/local/bin/newsboat + +newsboat -x reload +cd "${DOTFILES:-$HOME/.dotfiles}" +git commit -m "Newsboat cache" newsboat/cache.db +newsboat -x print-unread | xargs -I{} /usr/local/bin/terminal-notifier -group news -sender news -title 'Newsboat reloaded' -message "{}" +previous_commit_msg="$(git log --format=%s -n 1 HEAD~)" +if [ "$previous_commit_msg" = "Newsboat cache" ]; then + git stash save \ + && git reset --soft HEAD~2 \ + && git commit -m "Newsboat cache" \ + && git push --force-with-lease origin master \ + && git stash pop; +else + git push origin master +fi