feat: show architecture in tfenv list output (#321)#482
Merged
Conversation
tfenv list now displays the architecture of each installed binary:
* 1.5.0 (amd64) (set by /path/to/version)
1.4.0 (arm64)
Architecture is detected from the terraform binary using the file
command. Supported architectures: amd64, arm64, 386, arm.
Also updates the sed pattern in tfenv-uninstall to strip the new
parenthesized arch from list output when matching versions.
Fixes #321
On macOS arm64, older Terraform versions (pre-1.0) are amd64 binaries running under Rosetta. The test was using uname -m to predict the arch, which fails when installed binaries do not match the host architecture. Now uses the same file-based detection as tfenv-list itself.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
tfenv list now displays the architecture of each installed terraform binary:
Architecture is detected from the terraform binary using the
filecommand. Supported architectures:amd64,arm64,386,arm. Falls back tounknownif detection fails.Changes:
libexec/tfenv-list: Addeddetect_arch()function usingfile -bto inspect the binary. Updatedprint_version()to include arch.libexec/tfenv-uninstall: Updated sed pattern to strip parenthesized groups (arch + set-by) when parsing list output.test/test_list.sh: Updated expected output to include arch, dynamically detected fromuname -mfor cross-platform CI compatibility.Note: This PR will have a minor merge conflict with #481 (multi-version uninstall) on the sed pattern in
tfenv-uninstall. Both change the same line — resolution is to use thes/ \([^)]+\)//gpattern in the refactoreduninstall_single_version()function.Fixes #321