Skip to content

Commit

Permalink
Add debug logging
Browse files Browse the repository at this point in the history
  • Loading branch information
OJFord authored and Zordrak committed Oct 1, 2022
1 parent 42b5456 commit cd77bbb
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion libexec/tfenv-resolve-version
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,10 @@ if [[ "${version_requested}" =~ ^min-required$ ]]; then
fi;

if [[ "${version_requested}" =~ ^latest-allowed$ ]]; then
log 'info' 'Detecting latest allowable version...';
log 'debug' 'Detecting latest allowable version...';
version_spec="$(grep -h required_version "${TFENV_DIR:-$(pwd)}"/{*.tf,*.tf.json} 2>/dev/null | rev | cut -d'"' -f2 | rev | cut -d, -f1)";
version_num="$(echo "${version_spec}" | sed -E 's/[^0-9.]+//')";
log 'debug' "Using ${version_num} from version spec: ${version_spec}";

case "${version_spec}" in
'>'*)
Expand All @@ -147,6 +148,7 @@ if [[ "${version_requested}" =~ ^latest-allowed$ ]]; then
log 'error' "Unsupported version spec: '${version_spec}', only >, >=, <=, and ~> are supported.";
;;
esac;
log 'debug' "Determined the requested version to be: ${version_requested}";
fi;

if [[ "${version_requested}" =~ ^latest\:.*$ ]]; then
Expand Down

0 comments on commit cd77bbb

Please sign in to comment.