dotfiles

configuration files for shell, text editor, graphical environment, etc.
git clone git://src.adamsgaard.dk/dotfiles # fast
git clone https://src.adamsgaard.dk/dotfiles.git # slow
Log | Files | Refs | README | LICENSE Back to index

commit e3cf5388c8b05311db14c96caa724060738f0cec
parent 8905a6b8296724e8dcaa56d71fa00484a41a8dcc
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date:   Tue,  2 Feb 2021 15:36:47 +0100

news: fall back to curl(1) if hurl(1) isn't installed

Diffstat:
M.local/bin/news | 16+++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/.local/bin/news b/.local/bin/news @@ -1,6 +1,20 @@ #!/bin/sh + +die() { + printf '%s: error: %s\n' "${0##*/}" "$1" >&2 + exit 1 +} + +if command -v hurl >/dev/null 2>&1; then + downloader=hurl +elif command -v curl >/dev/null 2>&1; then + downloader="curl -s" +else + die 'hurl or curl not found' +fi + if [ $# -eq 0 ] || [ "$1" = "dr" ]; then - hurl https://www.dr.dk/nyheder/service/feeds/allenyheder | \ + $downloader https://www.dr.dk/nyheder/service/feeds/allenyheder | \ sfeed | sfeed_curses elif [ "$1" = "npr" ]; then url="https://text.npr.org"