Skip to content

Conversation

@clay-curry
Copy link

Support for this PR was originally articulated by @marler8997 as a // TODO on line 83.

This PR proposes a rather minor change to effectively extend the current functionality of the two existing CLI options (--install-dir and --path-link) such that they now will automatically inherit their values from environment variables (ZIG_INSTALL_DIR and ZIG_PATH_LINK, respectively). Documentation (via the help message zigup -h) was updated accordingly.

@clay-curry clay-curry closed this Nov 4, 2023
@clay-curry
Copy link
Author

I discovered an issue with ZIG_PATH_LINK. One moment.

@clay-curry clay-curry reopened this Nov 4, 2023
@clay-curry
Copy link
Author

Disregard. It was a non-issue.

fn allocInstallDirString(allocator: Allocator) ![]const u8 {
// TODO: maybe support ZIG_INSTALL_DIR environment variable?
// TODO: maybe support a file on the filesystem to configure install dir?
if(std.os.getenv("ZIG_INSTALL_DIR")) |install_dir| {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

std.os.getenv not working on Windows, but try std.process.getEnvVarOwned is cross-platform.


fn makeZigPathLinkString(allocator: Allocator) ![]const u8 {
if (global_optional_path_link) |path| return path;
if (std.os.getenv("ZIG_PATH_LINK")) |path_link| {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here!!

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