Skip to content

Commit 0329188

Browse files
committed
Remove active-toolchain-version and add help for show active-toolchain
1 parent 250328f commit 0329188

File tree

3 files changed

+10
-43
lines changed

3 files changed

+10
-43
lines changed

src/rustup-cli/help.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,15 @@ pub static SHOW_HELP: &'static str = r"DISCUSSION:
1717
If there are multiple toolchains installed then all installed
1818
toolchains are listed as well.";
1919

20+
pub static SHOW_ACTIVE_TOOLCHAIN_HELP: &'static str = r"DISCUSSION:
21+
Shows the name of the active toolchain.
22+
23+
This is useful for figuring out the active tool chain from
24+
scripts.
25+
26+
You should use `rustc --print sysroot` to get the sysroot, or
27+
`rustc --version` to get the toolchain version.";
28+
2029
pub static UPDATE_HELP: &'static str = r"DISCUSSION:
2130
With no toolchain specified, the `update` command updates each of
2231
the installed toolchains from the official release channels, then

src/rustup-cli/rustup_mode.rs

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ pub fn main() -> Result<()> {
3131
match matches.subcommand() {
3232
("show", Some(c)) => match c.subcommand() {
3333
("active-toolchain", Some(_)) => show_active_toolchain(cfg)?,
34-
("active-toolchain-version", Some(_)) => show_active_toolchain_version(cfg)?,
3534
(_, _) => show(cfg)?
3635
},
3736
("install", Some(m)) => update(cfg, m)?,
@@ -119,9 +118,7 @@ pub fn cli() -> App<'static, 'static> {
119118
.setting(AppSettings::DeriveDisplayOrder)
120119
.subcommand(SubCommand::with_name("active-toolchain")
121120
.about("Show the active toolchain")
122-
)
123-
.subcommand(SubCommand::with_name("active-toolchain-version")
124-
.about("Show the active toolchain version")
121+
.after_help(SHOW_ACTIVE_TOOLCHAIN_HELP)
125122
),
126123
)
127124
.subcommand(
@@ -758,19 +755,6 @@ fn show_active_toolchain(cfg: &Cfg) -> Result<()> {
758755
Ok(())
759756
}
760757

761-
fn show_active_toolchain_version(cfg: &Cfg) -> Result<()> {
762-
let ref cwd = utils::current_dir()?;
763-
match cfg.find_override_toolchain_or_default(cwd)? {
764-
Some((ref toolchain, _)) => {
765-
println!("{}", common::rustc_version(toolchain));
766-
},
767-
None => {
768-
// Print nothing
769-
}
770-
}
771-
Ok(())
772-
}
773-
774758
fn target_list(cfg: &Cfg, m: &ArgMatches) -> Result<()> {
775759
let toolchain = explicit_or_dir_toolchain(cfg, m)?;
776760

tests/cli-rustup.rs

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -873,32 +873,6 @@ fn show_active_toolchain_none() {
873873
});
874874
}
875875

876-
#[test]
877-
fn show_active_toolchain_version() {
878-
setup(&|config| {
879-
expect_ok(config, &["rustup", "default", "nightly"]);
880-
expect_ok_ex(
881-
config,
882-
&["rustup", "show", "active-toolchain-version"],
883-
r"1.3.0 (hash-n-2)
884-
",
885-
r"",
886-
);
887-
});
888-
}
889-
890-
#[test]
891-
fn show_active_toolchain_version_none() {
892-
setup(&|config| {
893-
expect_ok_ex(
894-
config,
895-
&["rustup", "show", "active-toolchain-version"],
896-
r"",
897-
r"",
898-
);
899-
});
900-
}
901-
902876
// #846
903877
#[test]
904878
fn set_default_host() {

0 commit comments

Comments
 (0)