mirror of
https://github.com/esp-rs/espup.git
synced 2025-10-02 15:14:56 +00:00
refactor: ♻️ Add uninstall method
This commit is contained in:
parent
f25545e0f3
commit
68a116b00c
@ -228,6 +228,11 @@ impl Crate {
|
|||||||
pub fn parse_crates(arg: &str) -> Result<HashSet<Crate>> {
|
pub fn parse_crates(arg: &str) -> Result<HashSet<Crate>> {
|
||||||
Ok(arg.split(',').map(Crate::new).collect())
|
Ok(arg.split(',').map(Crate::new).collect())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn uninstall(extra_crate: &str) -> Result<(), Error> {
|
||||||
|
cmd!("cargo", "uninstall", extra_crate).run()?;
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[async_trait]
|
#[async_trait]
|
||||||
@ -262,6 +267,22 @@ impl RiscVTarget {
|
|||||||
nightly_version: nightly_version.to_string(),
|
nightly_version: nightly_version.to_string(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Uninstalls the RISC-V target.
|
||||||
|
pub fn uninstall(nightly_version: &str) -> Result<(), Error> {
|
||||||
|
info!("{} Uninstalling RISC-V target", emoji::WRENCH);
|
||||||
|
cmd!(
|
||||||
|
"rustup",
|
||||||
|
"target",
|
||||||
|
"remove",
|
||||||
|
"--toolchain",
|
||||||
|
nightly_version,
|
||||||
|
"riscv32imc-unknown-none-elf",
|
||||||
|
"riscv32imac-unknown-none-elf"
|
||||||
|
)
|
||||||
|
.run()?;
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[async_trait]
|
#[async_trait]
|
||||||
@ -431,23 +452,6 @@ fn install_rust_nightly(version: &str) -> Result<()> {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Uninstalls the RISC-V target.
|
|
||||||
pub fn uninstall_riscv_target(nightly_version: &str) -> Result<()> {
|
|
||||||
info!("{} Uninstalling RISC-V target", emoji::WRENCH);
|
|
||||||
cmd!(
|
|
||||||
"rustup",
|
|
||||||
"target",
|
|
||||||
"remove",
|
|
||||||
"--toolchain",
|
|
||||||
nightly_version,
|
|
||||||
"riscv32imc-unknown-none-elf",
|
|
||||||
"riscv32imac-unknown-none-elf"
|
|
||||||
)
|
|
||||||
.run()
|
|
||||||
.into_diagnostic()?;
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate::toolchain::rust::{Crate, XtensaRust};
|
use crate::toolchain::rust::{Crate, XtensaRust};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user