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 a set-dotnet-env script for Xonsh #20

Merged
merged 1 commit into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ For fish shell, instead use:

`source ~/.asdf/plugins/dotnet/set-dotnet-env.fish`

For xonsh shell, instead use:

`source ~/.asdf/plugins/dotnet/set-dotnet-env.xsh`

# Contributing

Contributions of any kind welcome! See the [contributing guide](contributing.md).
Expand Down
16 changes: 16 additions & 0 deletions set-dotnet-env.xsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env xonsh

def asdf_update_dotnet_home() -> None:
dotnet_path=$(asdf which dotnet).rstrip('\n')
if dotnet_path:
$DOTNET_ROOT=$(dirname $(realpath @(dotnet_path))).rstrip('\n')
dotnet_version=$(dotnet --version).rstrip('\n')
$MSBuildSDKsPath=$DOTNET_ROOT + "/sdk/" + dotnet_version + "/Sdks"

@events.on_chdir
def update_dotnet_home_on_chdir(olddir, newdir, **kw) -> None:
asdf_update_dotnet_home()

@events.on_post_init
def update_dotnet_home_on_post_init() -> None:
asdf_update_dotnet_home()
Loading