Skip to content

Commit c8eddcb

Browse files
committed
fix(cli/rustup-mode): remove .num_args() when .value_delimiter(',') is present
1 parent 1dc7139 commit c8eddcb

7 files changed

+58
-31
lines changed

rustup-init.sh

+4-4
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@ Options:
5252
Choose a default toolchain to install. Use 'none' to not install any toolchains at all
5353
--profile <PROFILE>
5454
[default: default] [possible values: minimal, default, complete]
55-
-c, --component <COMPONENT>...
56-
Component name to also install
57-
-t, --target <TARGET>...
58-
Target name to also install
55+
-c, --component <COMPONENT>
56+
Comma-separated list of component names to also install
57+
-t, --target <TARGET>
58+
Comma-separated list of target names to also install
5959
--no-update-default-toolchain
6060
Don't update any existing default toolchain after install
6161
--no-modify-path

src/cli/rustup_mode.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -343,12 +343,12 @@ struct UpdateOpts {
343343
#[arg(long, value_enum)]
344344
profile: Option<Profile>,
345345

346-
/// Add specific components on installation
347-
#[arg(short, long, value_delimiter = ',', num_args = 1..)]
346+
/// Comma-separated list of components to be added on installation
347+
#[arg(short, long, value_delimiter = ',')]
348348
component: Vec<String>,
349349

350-
/// Add specific targets on installation
351-
#[arg(short, long, value_delimiter = ',', num_args = 1..)]
350+
/// Comma-separated list of targets to be added on installation
351+
#[arg(short, long, value_delimiter = ',')]
352352
target: Vec<String>,
353353

354354
/// Don't perform self update when running the `rustup toolchain install` command

src/cli/setup_mode.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,12 @@ struct RustupInit {
4848
#[arg(long, value_enum, default_value_t)]
4949
profile: Profile,
5050

51-
/// Component name to also install
52-
#[arg(short, long, value_delimiter = ',', num_args = 1..)]
51+
/// Comma-separated list of component names to also install
52+
#[arg(short, long, value_delimiter = ',')]
5353
component: Vec<String>,
5454

55-
/// Target name to also install
56-
#[arg(short, long, value_delimiter = ',', num_args = 1..)]
55+
/// Comma-separated list of target names to also install
56+
#[arg(short, long, value_delimiter = ',')]
5757
target: Vec<String>,
5858

5959
/// Don't update any existing default toolchain after install

tests/suite/cli-ui/rustup-init/rustup-init_help_flag_stdout.toml

+4-4
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ Options:
2121
Choose a default toolchain to install. Use 'none' to not install any toolchains at all
2222
--profile <PROFILE>
2323
[default: default] [possible values: minimal, default, complete]
24-
-c, --component <COMPONENT>...
25-
Component name to also install
26-
-t, --target <TARGET>...
27-
Target name to also install
24+
-c, --component <COMPONENT>
25+
Comma-separated list of component names to also install
26+
-t, --target <TARGET>
27+
Comma-separated list of target names to also install
2828
--no-update-default-toolchain
2929
Don't update any existing default toolchain after install
3030
--no-modify-path

tests/suite/cli-ui/rustup-init/rustup-init_sh_help_flag_stdout.toml

+4-4
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ Options:
2121
Choose a default toolchain to install. Use 'none' to not install any toolchains at all
2222
--profile <PROFILE>
2323
[default: default] [possible values: minimal, default, complete]
24-
-c, --component <COMPONENT>...
25-
Component name to also install
26-
-t, --target <TARGET>...
27-
Target name to also install
24+
-c, --component <COMPONENT>
25+
Comma-separated list of component names to also install
26+
-t, --target <TARGET>
27+
Comma-separated list of target names to also install
2828
--no-update-default-toolchain
2929
Don't update any existing default toolchain after install
3030
--no-modify-path

tests/suite/cli-ui/rustup/rustup_toolchain_cmd_install_cmd_help_flag_stdout.toml

+11-11
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@ Arguments:
1010
`rustup help toolchain`
1111
1212
Options:
13-
--profile <PROFILE> [possible values: minimal, default, complete]
14-
-c, --component <COMPONENT>... Add specific components on installation
15-
-t, --target <TARGET>... Add specific targets on installation
16-
--no-self-update Don't perform self update when running the `rustup toolchain
17-
install` command
18-
--force Force an update, even if some components are missing
19-
--allow-downgrade Allow rustup to downgrade the toolchain to satisfy your component
20-
choice
21-
--force-non-host Install toolchains that require an emulator. See
22-
https://github.com/rust-lang/rustup/wiki/Non-host-toolchains
23-
-h, --help Print help
13+
--profile <PROFILE> [possible values: minimal, default, complete]
14+
-c, --component <COMPONENT> Comma-separated list of components to be added on installation
15+
-t, --target <TARGET> Comma-separated list of targets to be added on installation
16+
--no-self-update Don't perform self update when running the `rustup toolchain install`
17+
command
18+
--force Force an update, even if some components are missing
19+
--allow-downgrade Allow rustup to downgrade the toolchain to satisfy your component
20+
choice
21+
--force-non-host Install toolchains that require an emulator. See
22+
https://github.com/rust-lang/rustup/wiki/Non-host-toolchains
23+
-h, --help Print help
2424
"""
2525
stderr = ""

tests/suite/cli_misc.rs

+27
Original file line numberDiff line numberDiff line change
@@ -1212,3 +1212,30 @@ async fn uninstall_self_smart_guess() {
12121212
.contains("if you meant to uninstall rustup itself, use `rustup self uninstall`"))
12131213
}
12141214
}
1215+
1216+
// https://github.com/rust-lang/rustup/issues/4073
1217+
#[tokio::test]
1218+
async fn toolchain_install_multi_components_comma() {
1219+
let mut cx = CliTestContext::new(Scenario::SimpleV2).await;
1220+
let components = ["rls", "rust-docs"];
1221+
cx.config
1222+
.expect_ok(&[
1223+
"rustup",
1224+
"toolchain",
1225+
"install",
1226+
"--profile=minimal",
1227+
"--component",
1228+
&components.join(","),
1229+
"nightly",
1230+
])
1231+
.await;
1232+
for component in components {
1233+
cx.config
1234+
.expect_ok_contains(
1235+
&["rustup", "+nightly", "component", "list", "--installed"],
1236+
for_host!("{component}-{}"),
1237+
"",
1238+
)
1239+
.await;
1240+
}
1241+
}

0 commit comments

Comments
 (0)