From d3274705564348957d030054f340cc9878d9cc86 Mon Sep 17 00:00:00 2001 From: Jordan Hiltunen Date: Mon, 17 Apr 2017 22:52:10 -0600 Subject: [PATCH] Alias 'rustup toolchain uninstall' to 'rustup uninstall' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The ‘rustup uninstall’ alias is patterned off of the implementation of ‘rustup install’. I’ve also added a test in cli-rustup.rs to verify. --- src/rustup-cli/rustup_mode.rs | 7 +++++++ tests/cli-rustup.rs | 16 ++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/src/rustup-cli/rustup_mode.rs b/src/rustup-cli/rustup_mode.rs index e8ae3d02bd..4d752a36f3 100644 --- a/src/rustup-cli/rustup_mode.rs +++ b/src/rustup-cli/rustup_mode.rs @@ -31,6 +31,7 @@ pub fn main() -> Result<()> { ("show", Some(_)) => try!(show(cfg)), ("install", Some(m)) => try!(update(cfg, m)), ("update", Some(m)) => try!(update(cfg, m)), + ("uninstall", Some(m)) => try!(toolchain_remove(cfg, m)), ("default", Some(m)) => try!(default_(cfg, m)), ("toolchain", Some(c)) => { match c.subcommand() { @@ -133,6 +134,12 @@ pub fn cli() -> App<'static, 'static> { .arg(Arg::with_name("toolchain") .required(true) .multiple(true))) + .subcommand(SubCommand::with_name("uninstall") + .about("Uninstall Rust toolchains") + .setting(AppSettings::Hidden) // synonym for 'toolchain uninstall' + .arg(Arg::with_name("toolchain") + .required(true) + .multiple(true))) .subcommand(SubCommand::with_name("update") .about("Update Rust toolchains") .after_help(UPDATE_HELP) diff --git a/tests/cli-rustup.rs b/tests/cli-rustup.rs index 68e22f07c2..ece19d182f 100644 --- a/tests/cli-rustup.rs +++ b/tests/cli-rustup.rs @@ -567,6 +567,22 @@ fn toolchain_update_is_like_update() { }); } + +#[test] +fn toolchain_uninstall_is_like_uninstall() { + setup(&|config| { + expect_ok(config, &["rustup", "uninstall", "nightly"]); + let mut cmd = clitools::cmd(config, "rustup", &["show"]); + clitools::env(config, &mut cmd); + let out = cmd.output().unwrap(); + assert!(out.status.success()); + let stdout = String::from_utf8(out.stdout).unwrap(); + assert!(!stdout.contains( + for_host!("'nightly-2015-01-01-{}'"))); + + }); +} + #[test] fn toolchain_update_is_like_update_except_that_bare_install_is_an_error() { setup(&|config| {