Skip to content

Commit

Permalink
Merge pull request #15 from opentofuutils/feat/pin
Browse files Browse the repository at this point in the history
feat: update tofuenv pin to not update .opentofu-version if no version is used
  • Loading branch information
anastasiiakozlova245 authored Dec 30, 2023
2 parents 359ef22 + 97430ee commit 0b64670
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions libexec/tofuenv-pin
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,11 @@ done;
version_name="$(tofuenv-version-name 2>/dev/null || true)" \
&& log 'debug' "tofuenv-version-name reported: ${version_name}";

echo "${version_name}" > .opentofu-version;
log 'info' "Pinned version by writing \"${version_name}\" to $(pwd)/.opentofu-version";
if [ -n "${version_name}" ]; then
echo "${version_name}" > .opentofu-version;
log 'info' "Pinned version by writing \"${version_name}\" to $(pwd)/.opentofu-version";
else
log 'error' "No version is currently used. Please first set one with: tofuenv use"
fi;

exit 0;

0 comments on commit 0b64670

Please sign in to comment.