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

Correct Nushell source command #4230

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

Conversation

Yethal
Copy link

@Yethal Yethal commented Mar 5, 2025

Nushell uses $env.HOME instead of $HOME syntax for environment variables. However since source is a parser keyword it cannot access environment variables which is why it should use $nu.home-path instead
Additionally, the original command will cause nushell to error out on next config evaluation

@Yethal Yethal force-pushed the proper-nushell-support branch from e36dd77 to 064cf6a Compare March 5, 2025 13:21
source "{cargo_home}/env.nu" # For nushell
. "{cargo_home}/env" # For sh/bash/zsh/ash/dash/pdksh
source "{cargo_home}/env.fish" # For fish
source $"($nu.home-path)/.cargo/env.nu" # For nushell
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that this is not necessary the $CARGO_HOME! It's just its default value...

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a scenario where $CARGO_HOME is set to a value different than default on a system and a human user will actually read this prompt? Or is it something that's only overriden in CI and such?

Copy link
Member

@rami3l rami3l Mar 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Yethal A human user will actually read the prompt. We allow $CARGO_HOME to be set to something else beforehand, actually IIRC we have suggested in an earlier note (before the actual installation, see https://github.com/search?q=repo%3Arust-lang%2Frustup+%22This+can+be+modified+with+the%22&type=code) that if you want it to be elsewhere you can set that and return to the installer.

Copy link
Member

@rami3l rami3l left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AIUI if $CARGO_HOME is something else then this will get out of sync with other commands.

I believe we should add a more friendly note instead of just using the default value, if the equivalent cannot be achieved in nushell.

@rami3l
Copy link
Member

rami3l commented Mar 5, 2025

It looks like we need something like https://www.nushell.sh/cookbook/foreign_shell_scripts.html but I'm not so sure... cc @LittleJianCH

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.

3 participants