Skip to content
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

added support for environment variables in leiu of options #105

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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.

// 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.

@@ -119,6 +126,9 @@ fn getInstallDir(allocator: Allocator, options: GetInstallDirOptions) ![]const u

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