diff --git a/rustup-init.sh b/rustup-init.sh index 58153aee0d..0f009b0af1 100755 --- a/rustup-init.sh +++ b/rustup-init.sh @@ -52,10 +52,10 @@ Options: Choose a default toolchain to install. Use 'none' to not install any toolchains at all --profile [default: default] [possible values: minimal, default, complete] - -c, --component ... - Component name to also install - -t, --target ... - Target name to also install + -c, --component + Comma-separated list of component names to also install + -t, --target + Comma-separated list of target names to also install --no-update-default-toolchain Don't update any existing default toolchain after install --no-modify-path diff --git a/src/cli/rustup_mode.rs b/src/cli/rustup_mode.rs index b8eedda402..547a59dd55 100644 --- a/src/cli/rustup_mode.rs +++ b/src/cli/rustup_mode.rs @@ -343,12 +343,12 @@ struct UpdateOpts { #[arg(long, value_enum)] profile: Option, - /// Add specific components on installation - #[arg(short, long, value_delimiter = ',', num_args = 1..)] + /// Comma-separated list of components to be added on installation + #[arg(short, long, value_delimiter = ',')] component: Vec, - /// Add specific targets on installation - #[arg(short, long, value_delimiter = ',', num_args = 1..)] + /// Comma-separated list of targets to be added on installation + #[arg(short, long, value_delimiter = ',')] target: Vec, /// Don't perform self update when running the `rustup toolchain install` command diff --git a/src/cli/setup_mode.rs b/src/cli/setup_mode.rs index d9ad3518f3..f737e13566 100644 --- a/src/cli/setup_mode.rs +++ b/src/cli/setup_mode.rs @@ -48,12 +48,12 @@ struct RustupInit { #[arg(long, value_enum, default_value_t)] profile: Profile, - /// Component name to also install - #[arg(short, long, value_delimiter = ',', num_args = 1..)] + /// Comma-separated list of component names to also install + #[arg(short, long, value_delimiter = ',')] component: Vec, - /// Target name to also install - #[arg(short, long, value_delimiter = ',', num_args = 1..)] + /// Comma-separated list of target names to also install + #[arg(short, long, value_delimiter = ',')] target: Vec, /// Don't update any existing default toolchain after install diff --git a/tests/suite/cli-ui/rustup-init/rustup-init_help_flag_stdout.toml b/tests/suite/cli-ui/rustup-init/rustup-init_help_flag_stdout.toml index c300ba12d7..3baeac1596 100644 --- a/tests/suite/cli-ui/rustup-init/rustup-init_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup-init/rustup-init_help_flag_stdout.toml @@ -21,10 +21,10 @@ Options: Choose a default toolchain to install. Use 'none' to not install any toolchains at all --profile [default: default] [possible values: minimal, default, complete] - -c, --component ... - Component name to also install - -t, --target ... - Target name to also install + -c, --component + Comma-separated list of component names to also install + -t, --target + Comma-separated list of target names to also install --no-update-default-toolchain Don't update any existing default toolchain after install --no-modify-path diff --git a/tests/suite/cli-ui/rustup-init/rustup-init_sh_help_flag_stdout.toml b/tests/suite/cli-ui/rustup-init/rustup-init_sh_help_flag_stdout.toml index 51087f3ba3..a54ca013e1 100644 --- a/tests/suite/cli-ui/rustup-init/rustup-init_sh_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup-init/rustup-init_sh_help_flag_stdout.toml @@ -21,10 +21,10 @@ Options: Choose a default toolchain to install. Use 'none' to not install any toolchains at all --profile [default: default] [possible values: minimal, default, complete] - -c, --component ... - Component name to also install - -t, --target ... - Target name to also install + -c, --component + Comma-separated list of component names to also install + -t, --target + Comma-separated list of target names to also install --no-update-default-toolchain Don't update any existing default toolchain after install --no-modify-path diff --git a/tests/suite/cli-ui/rustup/rustup_toolchain_cmd_install_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_toolchain_cmd_install_cmd_help_flag_stdout.toml index 6c56df7f7e..1e398f09ab 100644 --- a/tests/suite/cli-ui/rustup/rustup_toolchain_cmd_install_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_toolchain_cmd_install_cmd_help_flag_stdout.toml @@ -10,16 +10,16 @@ Arguments: `rustup help toolchain` Options: - --profile [possible values: minimal, default, complete] - -c, --component ... Add specific components on installation - -t, --target ... Add specific targets on installation - --no-self-update Don't perform self update when running the `rustup toolchain - install` command - --force Force an update, even if some components are missing - --allow-downgrade Allow rustup to downgrade the toolchain to satisfy your component - choice - --force-non-host Install toolchains that require an emulator. See - https://github.com/rust-lang/rustup/wiki/Non-host-toolchains - -h, --help Print help + --profile [possible values: minimal, default, complete] + -c, --component Comma-separated list of components to be added on installation + -t, --target Comma-separated list of targets to be added on installation + --no-self-update Don't perform self update when running the `rustup toolchain install` + command + --force Force an update, even if some components are missing + --allow-downgrade Allow rustup to downgrade the toolchain to satisfy your component + choice + --force-non-host Install toolchains that require an emulator. See + https://github.com/rust-lang/rustup/wiki/Non-host-toolchains + -h, --help Print help """ stderr = "" diff --git a/tests/suite/cli_misc.rs b/tests/suite/cli_misc.rs index 0361c85553..879a6ac9e9 100644 --- a/tests/suite/cli_misc.rs +++ b/tests/suite/cli_misc.rs @@ -1212,3 +1212,30 @@ async fn uninstall_self_smart_guess() { .contains("if you meant to uninstall rustup itself, use `rustup self uninstall`")) } } + +// https://github.com/rust-lang/rustup/issues/4073 +#[tokio::test] +async fn toolchain_install_multi_components_comma() { + let mut cx = CliTestContext::new(Scenario::SimpleV2).await; + let components = ["rls", "rust-docs"]; + cx.config + .expect_ok(&[ + "rustup", + "toolchain", + "install", + "--profile=minimal", + "--component", + &components.join(","), + "nightly", + ]) + .await; + for component in components { + cx.config + .expect_ok_contains( + &["rustup", "+nightly", "component", "list", "--installed"], + for_host!("{component}-{}"), + "", + ) + .await; + } +}