feat(rustup): add rustup.channels config (#1206)
This commit is contained in:
@@ -389,6 +389,12 @@ pub struct VscodeConfig {
|
||||
profile: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Default, Debug, Merge)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub struct Rustup {
|
||||
channels: Option<Vec<String>>,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Default, Debug, Merge)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
/// Configuration file
|
||||
@@ -473,6 +479,9 @@ pub struct ConfigFile {
|
||||
|
||||
#[merge(strategy = crate::utils::merge_strategies::inner_merge_opt)]
|
||||
vscode: Option<VscodeConfig>,
|
||||
|
||||
#[merge(strategy = crate::utils::merge_strategies::inner_merge_opt)]
|
||||
rustup: Option<Rustup>,
|
||||
}
|
||||
|
||||
fn config_directory() -> PathBuf {
|
||||
@@ -1493,6 +1502,14 @@ impl Config {
|
||||
.unwrap_or(true)
|
||||
}
|
||||
|
||||
pub fn rustup_channels(&self) -> Vec<String> {
|
||||
self.config_file
|
||||
.rustup
|
||||
.as_ref()
|
||||
.and_then(|rustup| rustup.channels.clone())
|
||||
.unwrap_or_default()
|
||||
}
|
||||
|
||||
pub fn verbose(&self) -> bool {
|
||||
self.opt.verbose
|
||||
}
|
||||
|
||||
@@ -262,7 +262,11 @@ pub fn run_rustup(ctx: &ExecutionContext) -> Result<()> {
|
||||
let rustup = require("rustup")?;
|
||||
|
||||
print_separator("rustup");
|
||||
ctx.execute(rustup).arg("update").status_checked()
|
||||
|
||||
ctx.execute(rustup)
|
||||
.arg("update")
|
||||
.args(ctx.config().rustup_channels())
|
||||
.status_checked()
|
||||
}
|
||||
|
||||
pub fn run_rye(ctx: &ExecutionContext) -> Result<()> {
|
||||
|
||||
Reference in New Issue
Block a user