feat: add get_home_directory to repo_utils (#809)
diff --git a/docs/repo_utils.md b/docs/repo_utils.md index 50d80c6..a79b219 100644 --- a/docs/repo_utils.md +++ b/docs/repo_utils.md
@@ -111,6 +111,24 @@ The environment variable value or the default if it is not set +<a id="repo_utils.get_home_directory"></a> + +## repo_utils.get_home_directory + +<pre> +repo_utils.get_home_directory(<a href="#repo_utils.get_home_directory-rctx">rctx</a>) +</pre> + + + +**PARAMETERS** + + +| Name | Description | Default Value | +| :------------- | :------------- | :------------- | +| <a id="repo_utils.get_home_directory-rctx"></a>rctx | <p align="center"> - </p> | none | + + <a id="repo_utils.os"></a> ## repo_utils.os
diff --git a/lib/private/repo_utils.bzl b/lib/private/repo_utils.bzl index f2aac0b..e700c3e 100644 --- a/lib/private/repo_utils.bzl +++ b/lib/private/repo_utils.bzl
@@ -55,6 +55,9 @@ return rctx.os.environ[name] return default +def _get_home_directory(rctx): + return _get_env_var(rctx, "HOME", None) + def _platform(rctx): """Returns a normalized name of the host os and CPU architecture. @@ -109,6 +112,7 @@ is_linux = _is_linux, is_windows = _is_windows, get_env_var = _get_env_var, + get_home_directory = _get_home_directory, os = _os, platform = _platform, )