Skip to content

feat: show architecture in tfenv list output (#321)#482

Merged
Zordrak merged 2 commits into
masterfrom
feat/321-list-arch
Apr 24, 2026
Merged

feat: show architecture in tfenv list output (#321)#482
Zordrak merged 2 commits into
masterfrom
feat/321-list-arch

Conversation

@Zordrak
Copy link
Copy Markdown
Collaborator

@Zordrak Zordrak commented Apr 24, 2026

tfenv list now displays the architecture of each installed terraform binary:

* 1.5.0 (amd64) (set by /home/user/.terraform-version)
  1.4.0 (arm64)
  1.3.0 (amd64)

Architecture is detected from the terraform binary using the file command. Supported architectures: amd64, arm64, 386, arm. Falls back to unknown if detection fails.

Changes:

  • libexec/tfenv-list: Added detect_arch() function using file -b to inspect the binary. Updated print_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 from uname -m for 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 the s/ \([^)]+\)//g pattern in the refactored uninstall_single_version() function.

Fixes #321

Zordrak added 2 commits April 24, 2026 16:30
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.
@Zordrak Zordrak merged commit c9b9cb7 into master Apr 24, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tfenv list display ARCH

1 participant