You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Suggest uv tool update-shell in PowerShell (#11846)
## Summary
We need to decouple the "Is this shell supported by `update-shell`?"
logic from the "Does this shell have known configuration files?" logic,
specifically for Windows, which we can always update but not via
configuration files.
Closes#11803.
returnErr(anyhow::anyhow!("The executable directory {} is not in PATH, but the current shell could not be determined", executable_directory.simplified_display().cyan()));
56
-
};
57
-
58
-
// Look up the configuration files (e.g., `.bashrc`, `.zshrc`) for the shell.
59
-
let files = shell.configuration_files();
60
-
if files.is_empty(){
61
-
returnErr(anyhow::anyhow!("The executable directory {} is not in PATH, but updating {shell} is currently unsupported", executable_directory.simplified_display().cyan()));
62
-
}
51
+
returnOk(ExitStatus::Success);
52
+
}
63
53
64
-
// Prepare the command (e.g., `export PATH="$HOME/.cargo/bin:$PATH"`).
returnErr(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()));
67
-
};
68
-
69
-
// Update each file, as necessary.
70
-
letmut updated = false;
71
-
for file in files {
72
-
// Search for the command in the file, to avoid redundant updates.
returnErr(anyhow::anyhow!("The executable directory {} is not in PATH, but the current shell could not be determined", executable_directory.simplified_display().cyan()));
57
+
};
58
+
59
+
// Look up the configuration files (e.g., `.bashrc`, `.zshrc`) for the shell.
60
+
let files = shell.configuration_files();
61
+
if files.is_empty(){
62
+
returnErr(anyhow::anyhow!("The executable directory {} is not in PATH, but updating {shell} is currently unsupported", executable_directory.simplified_display().cyan()));
63
+
}
64
+
65
+
// Prepare the command (e.g., `export PATH="$HOME/.cargo/bin:$PATH"`).
returnErr(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()));
68
+
};
69
+
70
+
// Update each file, as necessary.
71
+
letmut updated = false;
72
+
for file in files {
73
+
// Search for the command in the file, to avoid redundant updates.
writeln!(printer.stderr(),"Restart your shell to apply changes")?;
131
-
Ok(ExitStatus::Success)
132
-
}else{
133
-
Err(anyhow::anyhow!("The executable directory {} is not in PATH, but the {shell} configuration files are already up-to-date", executable_directory.simplified_display().cyan()))
134
-
}
130
+
if updated {
131
+
writeln!(printer.stderr(),"Restart your shell to apply changes")?;
132
+
Ok(ExitStatus::Success)
133
+
}else{
134
+
Err(anyhow::anyhow!("The executable directory {} is not in PATH, but the {shell} configuration files are already up-to-date", executable_directory.simplified_display().cyan()))
0 commit comments