dotfiles

My personal shell configs and stuff
git clone git://git.alex.balgavy.eu/dotfiles.git
Log | Files | Refs | Submodules | README | LICENSE

commit 41fb2468b6d274b608d353a0b56a369e92efcbfa
parent f6e6b785823d7dd9ff0b80181fa4e23ace8d6662
Author: Alex Balgavy <a.balgavy@gmail.com>
Date:   Fri,  7 Aug 2020 21:52:36 +0200

newsrefreshd: more notifications for error cases

Former-commit-id: c0648d9c1a38cb134684df0e0a8809b170c3898d
Diffstat:
Mscripts/newsrefreshd | 17+++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/scripts/newsrefreshd b/scripts/newsrefreshd @@ -4,17 +4,22 @@ 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 "{}" +notidie() { + /usr/local/bin/terminal-notifier -group news -sender news -title "$1" -message "$2" + exit 1 +} + +newsboat -x reload || notidie "Newsboat: error reloading" "Unable to reload" +{ cd "${DOTFILES:-$HOME/.dotfiles}" && git commit -m "Newsboat cache" newsboat/cache.db; } || notidie "Newsboat: error committing cache" "Could not commit cache dotfile." previous_commit_msg="$(git log --format=%s -n 1 HEAD~)" if [ "$previous_commit_msg" = "Newsboat cache" ]; then - git stash save \ + { git stash save \ && git reset --soft HEAD~2 \ && git commit -m "Newsboat cache" \ && git push --force-with-lease origin master \ - && git stash pop; + && git stash pop; } || notidie "Newsboat error: refreshed but unpushed" "Could not push new cache, check the state of the git repository." else git push origin master fi + +newsboat -x print-unread | xargs -I{} /usr/local/bin/terminal-notifier -group news -sender news -title 'Newsboat reloaded' -message "{}"