generated from asdf-vm/asdf-plugin-template
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add scripts to set DOTNET_ROOT env variable
- Loading branch information
Showing
2 changed files
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
asdf_update_dotnet_home() { | ||
local dotnet_path | ||
dotnet_path="$(asdf which dotnet)" | ||
if [[ -n "${dotnet_path}" ]]; then | ||
export DOTNET_ROOT | ||
DOTNET_ROOT="$(dirname "$(realpath "${dotnet_path}")")" | ||
fi | ||
} | ||
|
||
prompt_command() { | ||
asdf_update_dotnet_home | ||
} | ||
|
||
export PROMPT_COMMAND="${PROMPT_COMMAND:+${PROMPT_COMMAND}; prompt_command}" | ||
export PROMPT_COMMAND="${PROMPT_COMMAND:-prompt_command}" |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
asdf_update_dotnet_home() { | ||
local dotnet_path | ||
dotnet_path="$(asdf which dotnet)" | ||
if [[ -n "${dotnet_path}" ]]; then | ||
export DOTNET_ROOT | ||
DOTNET_ROOT="$(dirname "$(realpath "${dotnet_path}")")" | ||
fi | ||
} | ||
|
||
autoload -U add-zsh-hook | ||
add-zsh-hook precmd asdf_update_dotnet_home |