Support setting ad-hoc version#83
Open
nhawke wants to merge 4 commits into
Open
Conversation
The ad hoc version setting provides a mechanism for running the zig binary outside a project dir without needing to explicitly specify a version. i.e. "zig fmt" instead of "zig 0.15.2 fmt". When inside a project dir, anyzig will still prefer the version specified in the build.zig[.zon] file. Also adds `zig any set-ad-hoc-version` command for setting the version. This uses a similar mechanism as the existing 'verbosity' setting for simplicity. Coming up with a more robust configuration system is outside the scope of this change.
Author
|
Just realized that there are tests squirreled away in the build file. Let me look through those and make the necessary changes... |
This test sets the version, which is not hermetic and therefore causes future test runs to be incorrect. The right way to test this would be to configure a temporary appdata directory which can be cleaned up after each test. For now, the best solution is to just comment the test out.
marler8997
reviewed
May 20, 2026
marler8997
left a comment
Owner
There was a problem hiding this comment.
overall looks reasonable, just have 1 change request
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.
closes #62
The ad hoc version setting provides a mechanism for running the zig binary outside a project dir without needing to explicitly specify a version. i.e. "zig fmt" instead of "zig 0.15.2 fmt". When inside a project dir, anyzig will still prefer the version specified in the build.zig[.zon] file.
Also adds
zig any set-ad-hoc-versioncommand for setting the version. This uses a similar mechanism as the existing 'verbosity' setting for simplicity. Coming up with a more robust configuration system is outside the scope of this change.Tested manually by going through the various scenarios for version selection (version specified, running
init, inside project directory).