Last active
August 7, 2017 11:12
-
-
Save abn/f6efd4ce3b899e1096912ca2a8278cff to your computer and use it in GitHub Desktop.
Makefile snippet: json -> shell env var
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
# delete a line in an environment file that sets a var | |
# env_del(var,file) | |
define env_del | |
@{ [[ ! -e "$(2)" ]] || sed -i /'$(1)='/d $(2); } || : | |
endef | |
# given a env var name and json file, minify and add to specified file | |
# env_minify_json(var, json, dest) | |
define env_minify_json | |
$(call env_del,$(1),$(3)) | |
@echo "$(1)=$$(jq -c . < $(2))" >> $(3) | |
endef |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment