terraform-google-cloud-operations
terraform-google-cloud-operations copied to clipboard
Refactor to remove Python script
Currently the scripts depend on Python for string manipulation.
We should either:
- Replace the Python logic with jq (to stick to shell utils)
- Replace the shell scripts with full Python scripts.
Turning a JSON array into a list of escaped shell args jq -r 'map("\"" + . + "\"") | join(",")' should do:
> echo '["a", "b", "cd ef", "$d"]' | jq -r 'map("\"" + . + "\"") | join(" ")'
"a" "b" "cd ef" "$d"
/edit: oh, apparently no escaping but comma-separation is required: jq -r '. | join(",")'
> echo '["a", "b", "cd ef", "$d"]' | jq -r '. | join(",")'
a,b,cd ef,$d