From 1eec563f3239ff91a27f9bc85573e6deadb91547 Mon Sep 17 00:00:00 2001 From: Matěj Cepl Date: Thu, 15 Aug 2024 03:58:24 +0200 Subject: chore: add alternative way to use multiple variables instead of JSON --- tmp.sh | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/tmp.sh b/tmp.sh index f94fc74..4925804 100755 --- a/tmp.sh +++ b/tmp.sh @@ -55,6 +55,37 @@ export URL_VARIANTS="{ } }" +# THE ALTERNATIVE WAY +# +# barstool_base_url='mcepl@shell.eng.rdu.redhat.com:public_html' +# barstool_target_url='http://file.rdu.redhat.com/~mcepl/' +# barstool_shorten_api='https://url.corp.redhat.com/new?' +# +# wotan_base_url='wotan:Export/' +# wotan_target_url='https://w3.suse.de/~mcepl/' +# +# tmp_base_url='fedorapeople.org:public_html/tmp/' +# tmp_target_url='https://mcepl.fedorapeople.org/tmp/' +# # tmp_shorten_api='http://is.gd/create.php?format=simple&url=' +# tmp_shorten_api='https://da.gd/s?url=' +# +# get() { local x; x="${cur_conf}_$1"; echo "${!x}"; } +# +# Example usage: +# +# $ cur_conf=barstool +# +# $ get base_url +# mcepl@shell.eng.rdu.redhat.com:public_html +# +# $ get target_url +# http://file.rdu.redhat.com/~mcepl/ +# +# $ cur_conf=wotan +# +# $ get base_url +# wotan:Export/ + # Requires GNU sed CMDNAME="$(basename "$0"|sed 's/./\L&/g')" CONFIG="$(echo "$URL_VARIANTS" |tr "'" '"'|jq -r ".$CMDNAME")" -- cgit