Skip to content

Commit ddf1112

Browse files
committed
feat(cli/help): discuss rustup toolchain install
1 parent 2dc6dd7 commit ddf1112

File tree

3 files changed

+41
-3
lines changed

3 files changed

+41
-3
lines changed

src/cli/help.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,13 @@ pub(crate) fn toolchain_help() -> String {
118118
)
119119
}
120120

121+
pub(crate) fn toolchain_install_help() -> String {
122+
format!(
123+
r"{HEADER}Discussion:{HEADER:#}
124+
{TOOLCHAIN_INSTALL_HINT}"
125+
)
126+
}
127+
121128
pub(crate) fn toolchain_link_help() -> String {
122129
format!(
123130
r"{HEADER}Discussion:{HEADER:#}
@@ -362,3 +369,13 @@ pub(crate) fn topic_arg_help() -> &'static str {
362369
}
363370

364371
const SUBHEADER: Style = Style::new().bold();
372+
373+
const TOOLCHAIN_INSTALL_HINT: &str =
374+
" Some environment variables allow you to customize certain parameters
375+
in toolchain installation, including:
376+
377+
- `RUSTUP_CONCURRENT_DOWNLOADS`: the number of concurrent downloads.
378+
- `RUSTUP_DOWNLOAD_TIMEOUT`: the download timeout in seconds.
379+
380+
See <https://rust-lang.github.io/rustup/devel/environment-variables.html>
381+
for more info.";

src/cli/rustup_mode.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ use crate::{
3232
maybe_resolvable_toolchain_arg_help, official_toolchain_arg_help, override_help,
3333
override_unset_help, resolvable_local_toolchain_arg_help,
3434
resolvable_toolchain_arg_help, run_help, rustup_help, show_active_toolchain_help,
35-
show_help, toolchain_help, toolchain_link_help, topic_arg_help, update_help,
35+
show_help, toolchain_help, toolchain_install_help, toolchain_link_help, topic_arg_help,
36+
update_help,
3637
},
3738
self_update::{self, SelfUpdateMode, check_rustup_update},
3839
topical_doc,
@@ -331,7 +332,7 @@ enum ToolchainSubcmd {
331332
},
332333

333334
/// Install or update the given toolchains, or by default the active toolchain
334-
#[command(aliases = ["update", "add"] )]
335+
#[command(aliases = ["update", "add"], after_help = toolchain_install_help())]
335336
Install {
336337
#[command(flatten)]
337338
opts: UpdateOpts,

tests/suite/cli_rustup_ui/rustup_toolchain_cmd_install_cmd_help_flag.stdout.term.svg

Lines changed: 21 additions & 1 deletion
Loading

0 commit comments

Comments
 (0)