fix: Add --env-vars, deprecate --envs (#410)

This commit is contained in:
Maksym Vlasov 2022-07-06 15:41:28 +03:00 committed by Anton Babenko
commit 2b35cad50f
15 changed files with 24 additions and 22 deletions

View file

@ -26,7 +26,7 @@ function common::initialize {
# ARGS (array) arguments that configure wrapped tool behavior
# HOOK_CONFIG (array) arguments that configure hook behavior
# TF_INIT_ARGS (array) arguments for `terraform init` command
# ENVS (array) environment variables will be available
# ENV_VARS (array) environment variables will be available
# for all 3rd-party tools executed by a hook.
# FILES (array) filenames to check
# Arguments:
@ -40,10 +40,11 @@ function common::parse_cmdline {
# Used inside `common::terraform_init` function
TF_INIT_ARGS=()
# Used inside `common::export_provided_env_vars` function
ENVS=()
ENV_VARS=()
local argv
argv=$(getopt -o a:,h:,i:,e: --long args:,hook-config:,init-args:,tf-init-args:,envs: -- "$@") || return
# TODO: Planned breaking change: remove `init-args`, `envs` as not self-descriptive
argv=$(getopt -o a:,h:,i:,e: --long args:,hook-config:,init-args:,tf-init-args:,envs:,env-vars: -- "$@") || return
eval "set -- $argv"
for argv; do
@ -64,9 +65,10 @@ function common::parse_cmdline {
TF_INIT_ARGS+=("$1")
shift
;;
-e | --envs)
# TODO: Planned breaking change: remove `--envs` as not self-descriptive
-e | --envs | --env-vars)
shift
ENVS+=("$1")
ENV_VARS+=("$1")
shift
;;
--)