terraform-google-cloud-operations icon indicating copy to clipboard operation
terraform-google-cloud-operations copied to clipboard

Refactor to remove Python script

Open morgante opened this issue 5 years ago • 1 comments

Currently the scripts depend on Python for string manipulation.

We should either:

  1. Replace the Python logic with jq (to stick to shell utils)
  2. Replace the shell scripts with full Python scripts.

morgante avatar Sep 10 '20 04:09 morgante

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

black-snow avatar Sep 20 '22 11:09 black-snow