-
Notifications
You must be signed in to change notification settings - Fork 760
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
Add a command to append uv's binary directory to PATH #4975
Conversation
@@ -86,6 +86,7 @@ fs2 = { version = "0.4.3" } | |||
futures = { version = "0.3.30" } | |||
glob = { version = "0.3.1" } | |||
hex = { version = "0.4.3" } | |||
home = { version = "0.5.9" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Already in our dependency tree.)
30a8816
to
df914fe
Compare
crates/uv-cli/src/lib.rs
Outdated
@@ -2037,6 +2037,8 @@ pub enum ToolCommand { | |||
List(ToolListArgs), | |||
/// Uninstall a tool. | |||
Uninstall(ToolUninstallArgs), | |||
/// Ensure that the tool executable directory is on `PATH`. | |||
Ensurepath, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't feel strongly about this being the name of the command.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Jinx.
// Prepare the command (e.g., `export PATH="$HOME/.cargo/bin:$PATH"`). | ||
let Some(command) = shell.prepend_path(&executable_directory) else { | ||
return Err(anyhow::anyhow!("The executable directory {} is not in PATH, but the necessary command to update {shell} could not be determined.", executable_directory.simplified_display().cyan())); | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's also the rustup pattern of a ~/.cargo/env
file e.g.
❯ cat ~/.cargo/env
#!/bin/sh
# rustup shell setup
# affix colons on either side of $PATH to simplify matching
case ":${PATH}:" in
*:"$HOME/.cargo/bin":*)
;;
*)
# Prepending path in case a system-installed rustc needs to be overridden
export PATH="$HOME/.cargo/bin:$PATH"
;;
esac
then we can suggest source
and add that to the shell instead? Idk what the trade-offs are there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I looked at that and the implementation, but I've never seen it before in other tools.
df914fe
to
e886356
Compare
I changed to |
Summary
I'll open follow-up tickets for Windows support.
Closes #4953.
Test Plan
Then:
Then:
Then: