Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cli/rustup-mode): remove .num_args() when .value_delimiter(',') is present #4076

Merged
merged 2 commits into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
10 changes: 5 additions & 5 deletions src/cli/rustup_mode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ enum RustupSubcmd {
#[arg(help = RESOLVABLE_LOCAL_TOOLCHAIN_ARG_HELP)]
toolchain: ResolvableLocalToolchainName,

#[arg(required = true, num_args = 1.., use_value_delimiter = false)]
#[arg(required = true, num_args = 1..)]
command: Vec<String>,

/// Install the requested toolchain if needed
Expand Down 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;
}
}
Loading