Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@jceb
Copy link
Contributor

@jceb jceb commented Nov 18, 2025

Description

Add direnv tool

Motivation and Context

  • I have raised an issue to propose this change, which has been given a label of design/approved by a maintainer (required)

How Has This Been Tested?

If updating or adding a new CLI to arkade get, run:

go build && ./hack/test-tool.sh direnv

+ ./arkade get direnv --arch arm64 --os darwin --quiet
+ file /home/jceb/.arkade/bin/direnv
/home/jceb/.arkade/bin/direnv: Mach-O 64-bit arm64 executable, flags:<|DYLDLINK|PIE>
+ rm /home/jceb/.arkade/bin/direnv
+ echo

+ ./arkade get direnv --arch x86_64 --os darwin --quiet
+ file /home/jceb/.arkade/bin/direnv
/home/jceb/.arkade/bin/direnv: Mach-O 64-bit x86_64 executable, flags:<|DYLDLINK|PIE>
+ rm /home/jceb/.arkade/bin/direnv
+ echo

+ ./arkade get direnv --arch x86_64 --os linux --quiet
+ file /home/jceb/.arkade/bin/direnv
/home/jceb/.arkade/bin/direnv: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, BuildID[sha1]=6ad367ddfda462e9fea16ca9b36f26bbc203b10d, stripped
+ rm /home/jceb/.arkade/bin/direnv
+ echo

+ ./arkade get direnv --arch aarch64 --os linux --quiet
+ file /home/jceb/.arkade/bin/direnv
/home/jceb/.arkade/bin/direnv: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), statically linked, BuildID[sha1]=d2e47e38ed58874f10839541388669696c177bb0, stripped
+ rm /home/jceb/.arkade/bin/direnv
+ echo

+ ./arkade get direnv --arch x86_64 --os mingw --quiet
+ file /home/jceb/.arkade/bin/direnv.exe
/home/jceb/.arkade/bin/direnv.exe: PE32+ executable (console) x86-64, for MS Windows, 8 sections
+ rm /home/jceb/.arkade/bin/direnv.exe
+ echo

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Documentation

  • I have updated the list of tools in README.md if (required) with ./arkade get --format markdown
  • I have updated the list of apps in README.md if (required) with ./arkade install --help

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I've read the CONTRIBUTION guide
  • I have signed-off my commits with git commit -s
  • I have tested this on arm, or have added code to prevent deployment

Signed-off-by: Jan Christoph Ebersbach <[email protected]>
@reviewfn
Copy link

reviewfn bot commented Nov 18, 2025

AI Pull Request Overview

Summary

  • Adds direnv tool support to arkade's get command, enabling users to download direnv binaries for multiple platforms
  • Updates documentation to include direnv in the tools list
  • Includes comprehensive unit tests for URL generation across supported OS/architecture combinations
  • No breaking changes; purely additive feature

Summary per file

Summary per file
File path Summary
README.md Added direnv entry to tools list and updated tool count from 178 to 179
pkg/get/get_test.go Added Test_DownloadDirenv function with test cases for linux (amd64/arm64), darwin (amd64/arm64), and windows (amd64)
pkg/get/tools.go Added Tool struct for direnv with URLTemplate supporting multiple platforms and architectures

Overall Assessment

Overall Assessment

The implementation is well-executed and follows established patterns in the arkade codebase. The changes correctly add direnv as a new downloadable tool with proper cross-platform support. The URL template handles the various OS/architecture combinations appropriately, and the test coverage includes the most commonly used platforms. The README update ensures users can discover the new tool. No regressions or migration concerns identified. The code is consistent with existing tool definitions and maintains the project's standards for security and reliability.

Detailed Review

Detailed Review

pkg/get/tools.go

  • Correctness: The Tool struct is properly defined with all required fields (Owner, Repo, Name, Description, BinaryTemplate, URLTemplate). The URLTemplate correctly uses Go template syntax to construct download URLs for different platforms.
  • Platform Support: Covers linux (amd64, arm64, armv7l), darwin (amd64, arm64), and windows (amd64). The template logic uses appropriate target names that match the actual release assets from the direnv GitHub repository.
  • Consistency: Follows the same pattern as other tools in the file, using similar template structures and field values.
  • Security: Downloads from official GitHub releases, which is consistent with other tools and poses no additional security risks.
  • Suggestion: Consider adding support for additional architectures like windows-arm64 if direnv releases support it, but this is not critical for the current implementation.

pkg/get/get_test.go

  • Test Coverage: The Test_DownloadDirenv function includes test cases for the major platforms: linux (amd64/arm64), darwin (amd64/arm64), and windows (amd64). This covers the most commonly used combinations.
  • Test Implementation: Uses the same test structure as other tool tests, verifying URL generation for each supported platform. The test version (v2.37.1) matches a real release.
  • Completeness: The test cases align with the URLTemplate logic. However, it doesn't test the armv7l case for linux, which is supported in the template but not exercised in tests.
  • Suggestion: Add a test case for linux armv7l to ensure complete coverage of the template logic.

README.md

  • Documentation: Correctly adds direnv to the tools list with appropriate description and link. Updates the tool count from 178 to 179.
  • Consistency: The description matches the one in the Tool struct. The formatting follows the existing table structure.
  • Accuracy: The tool count is correctly updated to reflect the addition of one new tool.

General Observations

  • Impact: This is a low-risk change that adds new functionality without affecting existing code paths. No migration required for existing users.
  • Performance: No performance implications; URL generation is template-based and efficient.
  • Testing: The PR includes both unit tests and manual testing across multiple platforms, as evidenced by the test output in the PR description.
  • Potential Improvements:
    • The hardcoded version (v2.37.1) could be made configurable in the future, but this follows the pattern of other tools.
    • Consider adding windows-arm64 support if direnv releases binaries for it.
  • Code Quality: The changes are clean, well-formatted, and follow Go conventions. No linting or style issues apparent.
/home/ubuntu/workdir/REVIEW.md

AI agent details.

Agent processing time: 37.647s
Environment preparation time: 5.904s
Total time from webhook: 46.252s

@alexellis alexellis merged commit f9d31ef into alexellis:master Nov 18, 2025
3 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.

2 participants