Skip to content

zig env: improve envvar handling and add command line args support #24549

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

silversquirl
Copy link
Contributor

I noticed zig env doesn't properly handle the ZIG_LIB_DIR envvar, so this fixes that. I also added --zig-lib-dir and --global-cache-dir args, because eg. a wrapper script for zig might pass those in.

@alexrp alexrp requested a review from mlugg August 3, 2025 08:40
@mlugg
Copy link
Member

mlugg commented Aug 3, 2025

ZIG_LIB_DIR env var handling was dealt with by #24012.

I don't understand the rationale for adding the --zig-lib-dir and --global-cache-dir args. Even if your zig is a wrapper script, it cannot just blindly forward options like --zig-lib-dir to arbitrary subcommands; it's nonsensical for a bunch of them, such as all of the "drop-in replacement" tooling (zig ar, zig cc, zig objcopy, etc), and also things like zig fmt. If you want to override your lib directory or cache directory globally, the way to do that isn't by injecting CLI arguments: it's using the environment variables!

Do you have a specific use case which would be solved by introducing these arguments?

@silversquirl
Copy link
Contributor Author

happy with the resolution in #24012! hadn't seen that pr ^-^

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