diff options
author | Matěj Cepl <mcepl@cepl.eu> | 2024-08-15 03:58:24 +0200 |
---|---|---|
committer | Matěj Cepl <mcepl@cepl.eu> | 2024-08-15 03:58:24 +0200 |
commit | 1eec563f3239ff91a27f9bc85573e6deadb91547 (patch) | |
tree | 42dc446385eb17b0c343de1c8f46a1d21edc47fd | |
parent | 90076b79820b756b64bb722e8ced300ee020549d (diff) | |
download | tmp-1eec563f3239ff91a27f9bc85573e6deadb91547.tar.gz |
chore: add alternative way to use multiple variables instead of JSON
-rwxr-xr-x | tmp.sh | 31 |
1 files changed, 31 insertions, 0 deletions
@@ -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")" |