From 7f6dc1bc65f81b9915dbe606da847b0dec15c248 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Tue, 19 Jul 2022 13:07:38 -0500 Subject: Add runcmd --- runsfeed | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/runsfeed b/runsfeed index bc49937..75b141b 100755 --- a/runsfeed +++ b/runsfeed @@ -53,10 +53,16 @@ main() { } update_urls() { - cmd="$(command -v sfeed_update_urls.sh || echo ./sfeed_update_urls.sh)" +runcmd() { + cmd="$(command -v "$1" || echo "./$1")" + shift "$cmd" "$@" } +update_urls() { + runcmd sfeed_update_urls.sh "$@" +} + get_invidious_url() { "${NOFETCH:-false}" && return curl -sL "$1" | @@ -70,8 +76,7 @@ log() { } update() { - cmd="$(command -v sfeed_update_xargs || echo ./sfeed_update_xargs)" - "$cmd" "$@" + runcmd sfeed_update_xargs "$@" } opml() { @@ -79,8 +84,7 @@ opml() { } html() { - converter="$(command -v sfeed_html.sh || echo ./sfeed_html.sh)" - "$converter" "$@" + runcmd sfeed_html.sh "$@" } atom() ( # atom DIRECTORY [DAYS] -- cgit 1.4.1-21-gabe81