Skip to content

Commit

Permalink
fix: use regex instead of 'dotnet version' to speed up fish prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
hensou committed Jun 24, 2023
1 parent 78b81e4 commit 39651fb
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions set-dotnet-env.fish
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
function asdf_update_dotnet_home --on-event fish_prompt
set --local dotnet_path (asdf which dotnet)
if test -n "$dotnet_path"
set --local full_path (realpath "$dotnet_path")
set -gx DOTNET_ROOT (dirname "$full_path")
set --local dotnet_version (dotnet --version)
set -gx MSBuildSDKsPath (realpath "$DOTNET_ROOT/sdk/$dotnet_version/Sdks")

end
set --local dotnet_path (asdf which dotnet)
if test -n "$dotnet_path"
set --local full_path (realpath "$dotnet_path")
set -gx DOTNET_ROOT (dirname "$full_path")
set --local dotnet_version (string replace -r '.*/installs/dotnet/(.+)/[.].*' '$1' $dotnet_path)
set -gx MSBuildSDKsPath (realpath "$DOTNET_ROOT/sdk/$dotnet_version/Sdks")
end
end

0 comments on commit 39651fb

Please sign in to comment.