Skip to content

Commit

Permalink
fix(cli/rustup-mode): remove .num_args() when `.value_delimiter(','…
Browse files Browse the repository at this point in the history
…)` is present
  • Loading branch information
rami3l committed Nov 13, 2024
1 parent 1dc7139 commit c8eddcb
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 31 deletions.
8 changes: 4 additions & 4 deletions rustup-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ Options:
Choose a default toolchain to install. Use 'none' to not install any toolchains at all
--profile <PROFILE>
[default: default] [possible values: minimal, default, complete]
-c, --component <COMPONENT>...
Component name to also install
-t, --target <TARGET>...
Target name to also install
-c, --component <COMPONENT>
Comma-separated list of component names to also install
-t, --target <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
Expand Down
8 changes: 4 additions & 4 deletions src/cli/rustup_mode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -343,12 +343,12 @@ struct UpdateOpts {
#[arg(long, value_enum)]
profile: Option<Profile>,

/// 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<String>,

/// 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<String>,

/// Don't perform self update when running the `rustup toolchain install` command
Expand Down
8 changes: 4 additions & 4 deletions src/cli/setup_mode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<String>,

/// 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<String>,

/// Don't update any existing default toolchain after install
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ Options:
Choose a default toolchain to install. Use 'none' to not install any toolchains at all
--profile <PROFILE>
[default: default] [possible values: minimal, default, complete]
-c, --component <COMPONENT>...
Component name to also install
-t, --target <TARGET>...
Target name to also install
-c, --component <COMPONENT>
Comma-separated list of component names to also install
-t, --target <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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ Options:
Choose a default toolchain to install. Use 'none' to not install any toolchains at all
--profile <PROFILE>
[default: default] [possible values: minimal, default, complete]
-c, --component <COMPONENT>...
Component name to also install
-t, --target <TARGET>...
Target name to also install
-c, --component <COMPONENT>
Comma-separated list of component names to also install
-t, --target <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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ Arguments:
`rustup help toolchain`
Options:
--profile <PROFILE> [possible values: minimal, default, complete]
-c, --component <COMPONENT>... Add specific components on installation
-t, --target <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 <PROFILE> [possible values: minimal, default, complete]
-c, --component <COMPONENT> Comma-separated list of components to be added on installation
-t, --target <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 = ""
27 changes: 27 additions & 0 deletions tests/suite/cli_misc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

0 comments on commit c8eddcb

Please sign in to comment.