From 217b4a134cdbb078835f4347239d5b9281572f35 Mon Sep 17 00:00:00 2001 From: CyberLeo Date: Sat, 19 May 2012 09:52:04 -0500 Subject: [PATCH] DRY --- fetch | 14 ++++++-------- lib/{e621_settings.sh => profiles/e621} | 0 lib/{gelbooru_settings.sh => profiles/gelbooru} | 0 3 files changed, 6 insertions(+), 8 deletions(-) rename lib/{e621_settings.sh => profiles/e621} (100%) rename lib/{gelbooru_settings.sh => profiles/gelbooru} (100%) diff --git a/fetch b/fetch index e6ea080..30a72f9 100755 --- a/fetch +++ b/fetch @@ -5,8 +5,9 @@ pebkac() { cat < -Given an ID number from the Gelbooru site, downloads and stashes the full-size -image in the md5 directory and adds whatever tags are found into the tag area. +Given an ID number from the site: +* downloads and stashes the full-size image in the md5 directory +* adds whatever tags are found into the tag area EOF kill $$ exit 1 @@ -17,12 +18,9 @@ id="${1}" [ -z "$(echo "${id}" | tr -d '[0-9]')" ] || pebkac "ID should be an integer" taggery_name="$(basename "${0}")" -case "${taggery_name}" in -e621|gelbooru) - . "$(dirname "${0}")/lib/${taggery_name}_settings.sh" - ;; -*) pebkac "Unsupported" ;; -esac +taggery_profile="$(dirname "${0}")/lib/profiles/${taggery_name}" +[ -f "${taggery_profile}" ] || pebkac "Unsupported profile: ${taggery_name}" +. "${taggery_profile}" # Load KVS kvs=".${taggery_name}.kvdb" diff --git a/lib/e621_settings.sh b/lib/profiles/e621 similarity index 100% rename from lib/e621_settings.sh rename to lib/profiles/e621 diff --git a/lib/gelbooru_settings.sh b/lib/profiles/gelbooru similarity index 100% rename from lib/gelbooru_settings.sh rename to lib/profiles/gelbooru -- 2.42.0