Created
March 18, 2021 22:56
-
-
Save levicole/9f8089b8da408d7e3d590b211a7fb504 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -eo pipefail | |
json="{}" | |
while test $# != 0 | |
do | |
case "$1" in | |
--env-var1=*) | |
json=$(env_var1="${1#*=}" json="$json" jq -sn "(env.json|fromjson) * {\"ENV_VAR1\": env.env_var1}") | |
;; | |
--env-var2=*) | |
json=$(env_var2="${1#*=}" json="$json" jq -sn "(env.json|fromjson) * {\"ENV_VAR2\": env.env_var2}") | |
;; | |
*) | |
echo "I don't know how to do that" | |
;; | |
esac | |
shift | |
done | |
echo $json |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment