From ddf11124d63dfce1a70b3b73809bd3b5faf19b07 Mon Sep 17 00:00:00 2001 From: rami3l Date: Tue, 21 Oct 2025 22:56:22 +0800 Subject: [PATCH 1/3] feat(cli/help): discuss `rustup toolchain install` --- src/cli/help.rs | 17 ++++++++++++++ src/cli/rustup_mode.rs | 5 +++-- ..._cmd_install_cmd_help_flag.stdout.term.svg | 22 ++++++++++++++++++- 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/src/cli/help.rs b/src/cli/help.rs index aabb2ccabc..b57ca78411 100644 --- a/src/cli/help.rs +++ b/src/cli/help.rs @@ -118,6 +118,13 @@ pub(crate) fn toolchain_help() -> String { ) } +pub(crate) fn toolchain_install_help() -> String { + format!( + r"{HEADER}Discussion:{HEADER:#} +{TOOLCHAIN_INSTALL_HINT}" + ) +} + pub(crate) fn toolchain_link_help() -> String { format!( r"{HEADER}Discussion:{HEADER:#} @@ -362,3 +369,13 @@ pub(crate) fn topic_arg_help() -> &'static str { } const SUBHEADER: Style = Style::new().bold(); + +const TOOLCHAIN_INSTALL_HINT: &str = + " Some environment variables allow you to customize certain parameters + in toolchain installation, including: + + - `RUSTUP_CONCURRENT_DOWNLOADS`: the number of concurrent downloads. + - `RUSTUP_DOWNLOAD_TIMEOUT`: the download timeout in seconds. + + See + for more info."; diff --git a/src/cli/rustup_mode.rs b/src/cli/rustup_mode.rs index a3137c6f51..52008e2197 100644 --- a/src/cli/rustup_mode.rs +++ b/src/cli/rustup_mode.rs @@ -32,7 +32,8 @@ use crate::{ maybe_resolvable_toolchain_arg_help, official_toolchain_arg_help, override_help, override_unset_help, resolvable_local_toolchain_arg_help, resolvable_toolchain_arg_help, run_help, rustup_help, show_active_toolchain_help, - show_help, toolchain_help, toolchain_link_help, topic_arg_help, update_help, + show_help, toolchain_help, toolchain_install_help, toolchain_link_help, topic_arg_help, + update_help, }, self_update::{self, SelfUpdateMode, check_rustup_update}, topical_doc, @@ -331,7 +332,7 @@ enum ToolchainSubcmd { }, /// Install or update the given toolchains, or by default the active toolchain - #[command(aliases = ["update", "add"] )] + #[command(aliases = ["update", "add"], after_help = toolchain_install_help())] Install { #[command(flatten)] opts: UpdateOpts, diff --git a/tests/suite/cli_rustup_ui/rustup_toolchain_cmd_install_cmd_help_flag.stdout.term.svg b/tests/suite/cli_rustup_ui/rustup_toolchain_cmd_install_cmd_help_flag.stdout.term.svg index b6a052a117..949ab8939b 100644 --- a/tests/suite/cli_rustup_ui/rustup_toolchain_cmd_install_cmd_help_flag.stdout.term.svg +++ b/tests/suite/cli_rustup_ui/rustup_toolchain_cmd_install_cmd_help_flag.stdout.term.svg @@ -1,4 +1,4 @@ - +