all repos — chtf @ 1ac1d3f5c6fec1c74abd0c4e7766ea70771fdcde

simple terraform version manager

minor simplifications
Jes Olson j3s@c3f.net
Sun, 17 Jul 2022 11:25:06 -0500
commit

1ac1d3f5c6fec1c74abd0c4e7766ea70771fdcde

parent

5422426a09e56346ec782adcab526c1a6e7fd83a

1 files changed, 3 insertions(+), 2 deletions(-)

jump to
M chtfchtf

@@ -26,7 +26,8 @@ mkdir -p "$tf_install_dir"

if [ -z "$tf_version" ]; then [ -e "$tf_link_name" ] && active=$(readlink "$tf_link_name" | xargs basename) - for i in "$tf_install_dir"/*; do + cd "$tf_install_dir" + for i in *; do if [ "$i" = "$active" ]; then printf "%s*\n" "$i" else

@@ -40,7 +41,7 @@ printf "terraform version not found\ndownloading %s\n" "$dl"

curl -sS --location --fail --output /tmp/tf.zip "$dl" unzip /tmp/tf.zip -d /tmp >/dev/null mv /tmp/terraform "${tf_install_dir}/${tf_version}" - rm /tmp/tf.zip + rm -f /tmp/tf.zip fi mkdir -p "$HOME/bin" ln -sf "${tf_install_dir}/${tf_version}" "$tf_link_name"