diff --git a/src/cli/help.rs b/src/cli/help.rs index aabb2ccabc..84d8e7db6a 100644 --- a/src/cli/help.rs +++ b/src/cli/help.rs @@ -49,16 +49,16 @@ pub(crate) fn update_help() -> String { updates rustup itself. If given a toolchain argument then `update` updates that - toolchain, the same as `rustup toolchain install`." + toolchain, the same as `rustup toolchain install`. + +{TOOLCHAIN_INSTALL_HINT}" ) } pub(crate) fn install_help() -> String { format!( r"{HEADER}Discussion:{HEADER:#} - Installs a specific rust toolchain. - - The 'install' command is an alias for 'rustup update '." + The 'install' command is an alias for 'rustup toolchain install'." ) } @@ -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 @@ - +