diff --git a/Cargo.lock b/Cargo.lock index cf697e9f52..5b3e04389d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -129,17 +129,6 @@ dependencies = [ "syn 2.0.29", ] -[[package]] -name = "atty" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -dependencies = [ - "hermit-abi 0.1.19", - "libc", - "winapi", -] - [[package]] name = "autocfg" version = "1.1.0" @@ -311,37 +300,40 @@ dependencies = [ [[package]] name = "clap" -version = "3.2.25" +version = "4.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ea181bf566f71cb9a5d17a59e1871af638180a18fb0035c92ae62b705207123" +checksum = "c27cdf28c0f604ba3f512b0c9a409f8de8513e4816705deb0498b627e7c3a3fd" dependencies = [ - "atty", - "bitflags 1.3.2", + "clap_builder", +] + +[[package]] +name = "clap_builder" +version = "4.3.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08a9f1ab5e9f01a9b81f202e8562eb9a10de70abf9eaeac1be465c28b75aa4aa" +dependencies = [ + "anstream", + "anstyle", "clap_lex", - "indexmap 1.9.3", "strsim", - "termcolor", "terminal_size", - "textwrap", ] [[package]] name = "clap_complete" -version = "3.2.5" +version = "4.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f7a2e0a962c45ce25afce14220bc24f9dade0a1787f185cecf96bfba7847cd8" +checksum = "5fc443334c81a804575546c5a8a79b4913b50e28d69232903604cada1de817ce" dependencies = [ "clap", ] [[package]] name = "clap_lex" -version = "0.2.4" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2850f2f5a82cbf437dd5af4d49848fbdfc27c157c3d010345776f952765261c5" -dependencies = [ - "os_str_bytes", -] +checksum = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b" [[package]] name = "colorchoice" @@ -861,15 +853,6 @@ version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" -[[package]] -name = "hermit-abi" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" -dependencies = [ - "libc", -] - [[package]] name = "hermit-abi" version = "0.3.2" @@ -1034,7 +1017,7 @@ version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" dependencies = [ - "hermit-abi 0.3.2", + "hermit-abi", "libc", "windows-sys 0.48.0", ] @@ -1051,7 +1034,7 @@ version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" dependencies = [ - "hermit-abi 0.3.2", + "hermit-abi", "rustix 0.38.8", "windows-sys 0.48.0", ] @@ -1281,7 +1264,7 @@ version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" dependencies = [ - "hermit-abi 0.3.2", + "hermit-abi", "libc", ] @@ -1473,12 +1456,6 @@ dependencies = [ "windows-sys 0.48.0", ] -[[package]] -name = "os_str_bytes" -version = "6.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d5d9eb14b174ee9aa2ef96dc2b94637a2d4b6e7cb873c7e171f0c20c6cf3eac" - [[package]] name = "overload" version = "0.1.1" @@ -2314,15 +2291,6 @@ dependencies = [ "windows-sys 0.48.0", ] -[[package]] -name = "textwrap" -version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d" -dependencies = [ - "terminal_size", -] - [[package]] name = "thiserror" version = "1.0.47" diff --git a/Cargo.toml b/Cargo.toml index 6f7922393d..feab52ff22 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -49,8 +49,8 @@ test = ["dep:once_cell", "dep:walkdir"] anyhow.workspace = true cfg-if = "1.0" chrono = { version = "0.4", default-features = false, features = ["std"] } -clap = { version = "3", features = ["wrap_help"] } -clap_complete = "3" +clap = { version = "4", features = ["wrap_help"] } +clap_complete = "4" derivative.workspace = true download = { path = "download", default-features = false } effective-limits = "0.5.5" diff --git a/rustup-init.sh b/rustup-init.sh index a822c5e30d..a7701c5336 100755 --- a/rustup-init.sh +++ b/rustup-init.sh @@ -26,47 +26,36 @@ RUSTUP_UPDATE_ROOT="${RUSTUP_UPDATE_ROOT:-https://static.rust-lang.org/rustup}" usage() { cat < - Choose a default host triple - - --default-toolchain - 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 - - --no-update-default-toolchain - Don't update any existing default toolchain after install - - --no-modify-path - Don't configure the PATH environment variable - - -h, --help - Print help information +The installer for rustup - -V, --version - Print version information +Usage: rustup-init[EXE] [OPTIONS] + +Options: + -v, --verbose + Enable verbose output + -q, --quiet + Disable progress output + -y + Disable confirmation prompt. + --default-host + Choose a default host triple + --default-toolchain + 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 + --no-update-default-toolchain + Don't update any existing default toolchain after install + --no-modify-path + Don't configure the PATH environment variable + -h, --help + Print help + -V, --version + Print version EOF } diff --git a/src/cli/help.rs b/src/cli/help.rs index 40591b9b6b..683249629c 100644 --- a/src/cli/help.rs +++ b/src/cli/help.rs @@ -1,4 +1,4 @@ -pub(crate) static RUSTUP_HELP: &str = r"DISCUSSION: +pub(crate) static RUSTUP_HELP: &str = r"Discussion: Rustup installs The Rust Programming Language from the official release channels, enabling you to easily switch between stable, beta, and nightly compilers and keep them updated. It makes @@ -8,7 +8,7 @@ pub(crate) static RUSTUP_HELP: &str = r"DISCUSSION: If you are new to Rust consider running `rustup doc --book` to learn Rust."; -pub(crate) static SHOW_HELP: &str = r"DISCUSSION: +pub(crate) static SHOW_HELP: &str = r"Discussion: Shows the name of the active toolchain and the version of `rustc`. If the active toolchain has installed support for additional @@ -17,7 +17,7 @@ pub(crate) static SHOW_HELP: &str = r"DISCUSSION: If there are multiple toolchains installed then all installed toolchains are listed as well."; -pub(crate) static SHOW_ACTIVE_TOOLCHAIN_HELP: &str = r"DISCUSSION: +pub(crate) static SHOW_ACTIVE_TOOLCHAIN_HELP: &str = r"Discussion: Shows the name of the active toolchain. This is useful for figuring out the active tool chain from @@ -26,7 +26,7 @@ pub(crate) static SHOW_ACTIVE_TOOLCHAIN_HELP: &str = r"DISCUSSION: You should use `rustc --print sysroot` to get the sysroot, or `rustc --version` to get the toolchain version."; -pub(crate) static UPDATE_HELP: &str = r"DISCUSSION: +pub(crate) static UPDATE_HELP: &str = r"Discussion: With no toolchain specified, the `update` command updates each of the installed toolchains from the official release channels, then updates rustup itself. @@ -34,16 +34,16 @@ pub(crate) static UPDATE_HELP: &str = r"DISCUSSION: If given a toolchain argument then `update` updates that toolchain, the same as `rustup toolchain install`."; -pub(crate) static INSTALL_HELP: &str = r"DISCUSSION: +pub(crate) static INSTALL_HELP: &str = r"Discussion: Installs a specific rust toolchain. The 'install' command is an alias for 'rustup update '."; -pub(crate) static DEFAULT_HELP: &str = r"DISCUSSION: +pub(crate) static DEFAULT_HELP: &str = r"Discussion: Sets the default toolchain to the one specified. If the toolchain is not already installed then it is installed first."; -pub(crate) static TOOLCHAIN_HELP: &str = r"DISCUSSION: +pub(crate) static TOOLCHAIN_HELP: &str = r"Discussion: Many `rustup` commands deal with *toolchains*, a single installation of the Rust compiler. `rustup` supports multiple types of toolchains. The most basic track the official release @@ -85,7 +85,7 @@ pub(crate) static TOOLCHAIN_HELP: &str = r"DISCUSSION: often used for developing Rust itself. For more information see `rustup toolchain help link`."; -pub(crate) static TOOLCHAIN_LINK_HELP: &str = r"DISCUSSION: +pub(crate) static TOOLCHAIN_LINK_HELP: &str = r"Discussion: 'toolchain' is the custom name to be assigned to the new toolchain. Any name is permitted as long as: - it does not include '/' or '\' except as the last character @@ -106,7 +106,7 @@ pub(crate) static TOOLCHAIN_LINK_HELP: &str = r"DISCUSSION: If you now compile a crate in the current directory, the custom toolchain 'latest-stage1' will be used."; -pub(crate) static OVERRIDE_HELP: &str = r"DISCUSSION: +pub(crate) static OVERRIDE_HELP: &str = r"Discussion: Overrides configure Rustup to use a specific toolchain when running in a specific directory. @@ -127,14 +127,14 @@ pub(crate) static OVERRIDE_HELP: &str = r"DISCUSSION: override and use the default toolchain again, `rustup override unset`."; -pub(crate) static OVERRIDE_UNSET_HELP: &str = r"DISCUSSION: +pub(crate) static OVERRIDE_UNSET_HELP: &str = r"Discussion: If `--path` argument is present, removes the override toolchain for the specified directory. If `--nonexistent` argument is present, removes the override toolchain for all nonexistent directories. Otherwise, removes the override toolchain for the current directory."; -pub(crate) static RUN_HELP: &str = r"DISCUSSION: +pub(crate) static RUN_HELP: &str = r"Discussion: Configures an environment to use the given toolchain and then runs the specified program. The command may be any program, not just rustc or cargo. This can be used for testing arbitrary toolchains @@ -149,14 +149,14 @@ pub(crate) static RUN_HELP: &str = r"DISCUSSION: $ rustup run nightly cargo build"; -pub(crate) static DOC_HELP: &str = r"DISCUSSION: +pub(crate) static DOC_HELP: &str = r"Discussion: Opens the documentation for the currently active toolchain with the default browser. By default, it opens the documentation index. Use the various flags to open specific pieces of documentation."; -pub(crate) static COMPLETIONS_HELP: &str = r"DISCUSSION: +pub(crate) static COMPLETIONS_HELP: &str = r"Discussion: Enable tab completion for Bash, Fish, Zsh, or PowerShell The script is output on `stdout`, allowing one to re-direct the output to the file of their choosing. Where you place the file @@ -167,7 +167,7 @@ pub(crate) static COMPLETIONS_HELP: &str = r"DISCUSSION: Here are some common set ups for the three supported shells under Unix and similar operating systems (such as GNU/Linux). - BASH: + Bash: Completion files are commonly stored in `/etc/bash_completion.d/` for system-wide commands, but can be stored in @@ -180,7 +180,7 @@ pub(crate) static COMPLETIONS_HELP: &str = r"DISCUSSION: This installs the completion script. You may have to log out and log back in to your shell session for the changes to take effect. - BASH (macOS/Homebrew): + Bash (macOS/Homebrew): Homebrew stores bash completion files within the Homebrew directory. With the `bash-completion` brew formula installed, run the command: @@ -188,7 +188,7 @@ pub(crate) static COMPLETIONS_HELP: &str = r"DISCUSSION: $ mkdir -p $(brew --prefix)/etc/bash_completion.d $ rustup completions bash > $(brew --prefix)/etc/bash_completion.d/rustup.bash-completion - FISH: + Fish: Fish completion files are commonly stored in `$HOME/.config/fish/completions`. Run the command: @@ -199,7 +199,7 @@ pub(crate) static COMPLETIONS_HELP: &str = r"DISCUSSION: This installs the completion script. You may have to log out and log back in to your shell session for the changes to take effect. - ZSH: + Zsh: ZSH completions are commonly stored in any directory listed in your `$fpath` variable. To use these completions, you must either @@ -229,7 +229,7 @@ pub(crate) static COMPLETIONS_HELP: &str = r"DISCUSSION: for the new completions to take effect. - CUSTOM LOCATIONS: + Custom locations: Alternatively, you could save these files to the place of your choosing, such as a custom directory inside your $HOME. Doing so @@ -237,7 +237,7 @@ pub(crate) static COMPLETIONS_HELP: &str = r"DISCUSSION: inside your login script. Consult your shells documentation for how to add such directives. - POWERSHELL: + PowerShell: The powershell completion scripts require PowerShell v5.0+ (which comes with Windows 10, but can be downloaded separately for windows 7 @@ -261,18 +261,18 @@ pub(crate) static COMPLETIONS_HELP: &str = r"DISCUSSION: PS C:\> rustup completions powershell >> ${env:USERPROFILE}\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1 - CARGO: + Cargo: Rustup can also generate a completion script for `cargo`. The script output by `rustup` will source the completion script distributed with your default toolchain. Not all shells are currently supported. Here are examples for the currently supported shells. - BASH: + Bash: $ rustup completions bash cargo >> ~/.local/share/bash-completion/completions/cargo - ZSH: + Zsh: $ rustup completions zsh cargo > ~/.zfunc/_cargo"; diff --git a/src/cli/rustup_mode.rs b/src/cli/rustup_mode.rs index 8dd6577750..71f86581d9 100644 --- a/src/cli/rustup_mode.rs +++ b/src/cli/rustup_mode.rs @@ -6,8 +6,8 @@ use std::str::FromStr; use anyhow::{anyhow, Error, Result}; use clap::{ - builder::{EnumValueParser, PossibleValuesParser}, - AppSettings, Arg, ArgAction, ArgEnum, ArgGroup, ArgMatches, Command, PossibleValue, + builder::{EnumValueParser, PossibleValue, PossibleValuesParser}, + Arg, ArgAction, ArgGroup, ArgMatches, Command, ValueEnum, }; use clap_complete::Shell; @@ -89,7 +89,7 @@ where pub fn main() -> Result { self_update::cleanup_self_updater()?; - use clap::ErrorKind::*; + use clap::error::ErrorKind::*; let matches = match cli().try_get_matches_from(process().args_os()) { Ok(matches) => Ok(matches), Err(err) if err.kind() == DisplayHelp => { @@ -243,17 +243,20 @@ pub fn main() -> Result { } _ => unreachable!(), }, - None => unreachable!(), + None => { + eprintln!("{}", cli().render_long_help()); + utils::ExitCode(1) + } }) } -pub(crate) fn cli() -> Command<'static> { +pub(crate) fn cli() -> Command { let mut app = Command::new("rustup") .version(common::version()) .about("The Rust toolchain installer") + .before_help(format!("rustup {}", common::version())) .after_help(RUSTUP_HELP) - .global_setting(AppSettings::DeriveDisplayOrder) - .setting(AppSettings::SubcommandRequiredElseHelp) + .subcommand_required(false) .arg( verbose_arg("Enable verbose output"), ) @@ -269,10 +272,11 @@ pub(crate) fn cli() -> Command<'static> { Arg::new("+toolchain") .help("release channel (e.g. +stable) or custom toolchain to set override") .value_parser(|s: &str| { + use clap::{Error, error::ErrorKind}; if let Some(stripped) = s.strip_prefix('+') { - ResolvableToolchainName::try_from(stripped).map_err(|e| clap::Error::raw(clap::ErrorKind::InvalidValue, e)) + ResolvableToolchainName::try_from(stripped).map_err(|e| Error::raw(ErrorKind::InvalidValue, e)) } else { - Err(clap::Error::raw(clap::ErrorKind::InvalidSubcommand, format!("\"{s}\" is not a valid subcommand, so it was interpreted as a toolchain name, but it is also invalid. {TOOLCHAIN_OVERRIDE_ERROR}"))) + Err(Error::raw(ErrorKind::InvalidSubcommand, format!("\"{s}\" is not a valid subcommand, so it was interpreted as a toolchain name, but it is also invalid. {TOOLCHAIN_OVERRIDE_ERROR}"))) } }), ) @@ -312,14 +316,13 @@ pub(crate) fn cli() -> Command<'static> { .help(OFFICIAL_TOOLCHAIN_ARG_HELP) .required(true) .value_parser(partial_toolchain_desc_parser) - .takes_value(true) - .multiple_values(true) + .num_args(1..) ) .arg( Arg::new("profile") .long("profile") .value_parser(PossibleValuesParser::new(Profile::names())) - .takes_value(true), + .num_args(1), ) .arg( Arg::new("no-self-update") @@ -348,8 +351,7 @@ pub(crate) fn cli() -> Command<'static> { .help(RESOLVABLE_TOOLCHAIN_ARG_HELP) .required(true) .value_parser(resolvable_toolchainame_parser) - .takes_value(true) - .multiple_values(true), + .num_args(1..) ), ) .subcommand( @@ -362,8 +364,7 @@ pub(crate) fn cli() -> Command<'static> { .help(OFFICIAL_TOOLCHAIN_ARG_HELP) .required(false) .value_parser(partial_toolchain_desc_parser) - .takes_value(true) - .multiple_values(true), + .num_args(1..) ) .arg( Arg::new("no-self-update") @@ -400,7 +401,8 @@ pub(crate) fn cli() -> Command<'static> { Command::new("toolchain") .about("Modify or query the installed toolchains") .after_help(TOOLCHAIN_HELP) - .setting(AppSettings::SubcommandRequiredElseHelp) + .subcommand_required(true) + .arg_required_else_help(true) .subcommand( Command::new("list") .about("List installed toolchains") @@ -417,22 +419,20 @@ pub(crate) fn cli() -> Command<'static> { .help(OFFICIAL_TOOLCHAIN_ARG_HELP) .required(true) .value_parser( partial_toolchain_desc_parser) - .takes_value(true) - .multiple_values(true), + .num_args(1..) ) .arg( Arg::new("profile") .long("profile") .value_parser(PossibleValuesParser::new(Profile::names())) - .takes_value(true), + .num_args(1), ) .arg( Arg::new("components") .help("Add specific components on installation") .long("component") .short('c') - .takes_value(true) - .multiple_values(true) + .num_args(1..) .use_value_delimiter(true) .action(ArgAction::Append), ) @@ -441,8 +441,7 @@ pub(crate) fn cli() -> Command<'static> { .help("Add specific targets on installation") .long("target") .short('t') - .takes_value(true) - .multiple_values(true) + .num_args(1..) .use_value_delimiter(true) .action(ArgAction::Append), ) @@ -453,7 +452,6 @@ pub(crate) fn cli() -> Command<'static> { `rustup toolchain install` command", ) .long("no-self-update") - .takes_value(true) .action(ArgAction::SetTrue) ) .arg( @@ -484,8 +482,7 @@ pub(crate) fn cli() -> Command<'static> { .help(RESOLVABLE_TOOLCHAIN_ARG_HELP) .required(true) .value_parser(resolvable_toolchainame_parser) - .takes_value(true) - .multiple_values(true), + .num_args(1..) ), ) .subcommand( @@ -508,7 +505,8 @@ pub(crate) fn cli() -> Command<'static> { .subcommand( Command::new("target") .about("Modify a toolchain's supported targets") - .setting(AppSettings::SubcommandRequiredElseHelp) + .subcommand_required(true) + .arg_required_else_help(true) .subcommand( Command::new("list") .about("List installed and available targets") @@ -517,7 +515,7 @@ pub(crate) fn cli() -> Command<'static> { .help(OFFICIAL_TOOLCHAIN_ARG_HELP) .long("toolchain") .value_parser(partial_toolchain_desc_parser) - .takes_value(true), + .num_args(1), ) .arg( Arg::new("installed") @@ -533,8 +531,7 @@ pub(crate) fn cli() -> Command<'static> { .arg( Arg::new("target") .required(true) - .takes_value(true) - .multiple_values(true) + .num_args(1..) .help( "List of targets to install; \ \"all\" installs all available targets" @@ -544,7 +541,7 @@ pub(crate) fn cli() -> Command<'static> { Arg::new("toolchain") .help(OFFICIAL_TOOLCHAIN_ARG_HELP) .long("toolchain") - .takes_value(true) + .num_args(1) .value_parser(partial_toolchain_desc_parser), ), ) @@ -556,14 +553,13 @@ pub(crate) fn cli() -> Command<'static> { Arg::new("target") .help("List of targets to uninstall") .required(true) - .takes_value(true) - .multiple_values(true) + .num_args(1..) ) .arg( Arg::new("toolchain") .help(OFFICIAL_TOOLCHAIN_ARG_HELP) .long("toolchain") - .takes_value(true) + .num_args(1) .value_parser(partial_toolchain_desc_parser), ), ), @@ -571,7 +567,8 @@ pub(crate) fn cli() -> Command<'static> { .subcommand( Command::new("component") .about("Modify a toolchain's installed components") - .setting(AppSettings::SubcommandRequiredElseHelp) + .subcommand_required(true) + .arg_required_else_help(true) .subcommand( Command::new("list") .about("List installed and available components") @@ -579,7 +576,7 @@ pub(crate) fn cli() -> Command<'static> { Arg::new("toolchain") .help(OFFICIAL_TOOLCHAIN_ARG_HELP) .long("toolchain") - .takes_value(true) + .num_args(1) .value_parser(partial_toolchain_desc_parser), ) .arg( @@ -593,36 +590,36 @@ pub(crate) fn cli() -> Command<'static> { Command::new("add") .about("Add a component to a Rust toolchain") .arg(Arg::new("component").required(true) - .takes_value(true).multiple_values(true)) + .num_args(1..)) .arg( Arg::new("toolchain") .help(OFFICIAL_TOOLCHAIN_ARG_HELP) .long("toolchain") - .takes_value(true) + .num_args(1) .value_parser( partial_toolchain_desc_parser), ) .arg( Arg::new("target") .long("target") - .takes_value(true) + .num_args(1) ), ) .subcommand( Command::new("remove") .about("Remove a component from a Rust toolchain") .arg(Arg::new("component").required(true) - .takes_value(true).multiple_values(true)) + .num_args(1..)) .arg( Arg::new("toolchain") .help(OFFICIAL_TOOLCHAIN_ARG_HELP) .long("toolchain") - .takes_value(true) + .num_args(1) .value_parser( partial_toolchain_desc_parser), ) .arg( Arg::new("target") .long("target") - .takes_value(true) + .num_args(1) ), ), ) @@ -630,7 +627,8 @@ pub(crate) fn cli() -> Command<'static> { Command::new("override") .about("Modify directory toolchain overrides") .after_help(OVERRIDE_HELP) - .setting(AppSettings::SubcommandRequiredElseHelp) + .subcommand_required(true) + .arg_required_else_help(true) .subcommand( Command::new("list").about("List directory toolchain overrides"), ) @@ -642,13 +640,13 @@ pub(crate) fn cli() -> Command<'static> { Arg::new("toolchain") .help(RESOLVABLE_TOOLCHAIN_ARG_HELP) .required(true) - .takes_value(true) + .num_args(1) .value_parser(resolvable_toolchainame_parser), ) .arg( Arg::new("path") .long("path") - .takes_value(true) + .num_args(1) .help("Path to the directory"), ), ) @@ -660,7 +658,7 @@ pub(crate) fn cli() -> Command<'static> { .arg( Arg::new("path") .long("path") - .takes_value(true) + .num_args(1) .help("Path to the directory"), ) .arg( @@ -680,14 +678,13 @@ pub(crate) fn cli() -> Command<'static> { Arg::new("toolchain") .help(RESOLVABLE_LOCAL_TOOLCHAIN_ARG_HELP) .required(true) - .takes_value(true) + .num_args(1) .value_parser(resolvable_local_toolchainame_parser), ) .arg( Arg::new("command") .required(true) - .takes_value(true) - .multiple_values(true) + .num_args(1..) .use_value_delimiter(false), ) .arg( @@ -705,7 +702,7 @@ pub(crate) fn cli() -> Command<'static> { Arg::new("toolchain") .help(RESOLVABLE_TOOLCHAIN_ARG_HELP) .long("toolchain") - .takes_value(true) + .num_args(1) .value_parser(resolvable_toolchainame_parser), ), ) @@ -724,7 +721,7 @@ pub(crate) fn cli() -> Command<'static> { Arg::new("toolchain") .help(OFFICIAL_TOOLCHAIN_ARG_HELP) .long("toolchain") - .takes_value(true) + .num_args(1) .value_parser(partial_toolchain_desc_parser), ) .arg(Arg::new("topic").help(TOPIC_ARG_HELP)) @@ -753,7 +750,7 @@ pub(crate) fn cli() -> Command<'static> { Arg::new("toolchain") .help(OFFICIAL_TOOLCHAIN_ARG_HELP) .long("toolchain") - .takes_value(true) + .num_args(1) .value_parser(partial_toolchain_desc_parser), ), ); @@ -763,7 +760,8 @@ pub(crate) fn cli() -> Command<'static> { .subcommand( Command::new("self") .about("Modify the rustup installation") - .setting(AppSettings::SubcommandRequiredElseHelp) + .subcommand_required(true) + .arg_required_else_help(true) .subcommand(Command::new("update").about("Download and install updates to rustup")) .subcommand( Command::new("uninstall") @@ -777,7 +775,8 @@ pub(crate) fn cli() -> Command<'static> { .subcommand( Command::new("set") .about("Alter rustup settings") - .setting(AppSettings::SubcommandRequiredElseHelp) + .subcommand_required(true) + .arg_required_else_help(true) .subcommand( Command::new("default-host") .about("The triple used to identify toolchains when not specified") @@ -819,7 +818,7 @@ pub(crate) fn cli() -> Command<'static> { ) } -fn verbose_arg(help: &str) -> Arg<'_> { +fn verbose_arg(help: &'static str) -> Arg { Arg::new("verbose") .help(help) .short('v') @@ -1675,7 +1674,7 @@ impl clap::ValueEnum for CompletionCommand { &[Self::Rustup, Self::Cargo] } - fn to_possible_value<'a>(&self) -> Option> { + fn to_possible_value<'a>(&self) -> Option { Some(match self { CompletionCommand::Rustup => PossibleValue::new("rustup"), CompletionCommand::Cargo => PossibleValue::new("cargo"), diff --git a/src/cli/setup_mode.rs b/src/cli/setup_mode.rs index 5f22db8e17..39a1368774 100644 --- a/src/cli/setup_mode.rs +++ b/src/cli/setup_mode.rs @@ -1,5 +1,5 @@ use anyhow::Result; -use clap::{builder::PossibleValuesParser, AppSettings, Arg, ArgAction, Command}; +use clap::{builder::PossibleValuesParser, Arg, ArgAction, Command}; use crate::{ cli::{ @@ -32,8 +32,8 @@ pub fn main() -> Result { // NOTICE: If you change anything here, please make the same changes in rustup-init.sh let cli = Command::new("rustup-init") .version(common::version()) + .before_help(format!("rustup-init {}", common::version())) .about("The installer for rustup") - .setting(AppSettings::DeriveDisplayOrder) .arg( Arg::new("verbose") .short('v') @@ -58,13 +58,13 @@ pub fn main() -> Result { .arg( Arg::new("default-host") .long("default-host") - .takes_value(true) + .num_args(1) .help("Choose a default host triple"), ) .arg( Arg::new("default-toolchain") .long("default-toolchain") - .takes_value(true) + .num_args(1) .help("Choose a default toolchain to install. Use 'none' to not install any toolchains at all") .value_parser(maybe_official_toolchainame_parser) ) @@ -79,8 +79,7 @@ pub fn main() -> Result { .help("Component name to also install") .long("component") .short('c') - .takes_value(true) - .multiple_values(true) + .num_args(1..) .use_value_delimiter(true) .action(ArgAction::Append), ) @@ -89,8 +88,7 @@ pub fn main() -> Result { .help("Target name to also install") .long("target") .short('t') - .takes_value(true) - .multiple_values(true) + .num_args(1..) .use_value_delimiter(true) .action(ArgAction::Append), ) @@ -110,8 +108,8 @@ pub fn main() -> Result { let matches = match cli.try_get_matches_from(process().args_os()) { Ok(matches) => matches, Err(e) - if e.kind() == clap::ErrorKind::DisplayHelp - || e.kind() == clap::ErrorKind::DisplayVersion => + if e.kind() == clap::error::ErrorKind::DisplayHelp + || e.kind() == clap::error::ErrorKind::DisplayVersion => { write!(process().stdout().lock(), "{e}")?; return Ok(utils::ExitCode(0)); 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 3aec80655d..6439bc795f 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 @@ -3,46 +3,35 @@ args = ["--help"] status.code = 0 stdout = """ rustup-init [..] -The installer for rustup - -USAGE: - rustup-init[EXE] [OPTIONS] - -OPTIONS: - -v, --verbose - Enable verbose output - - -q, --quiet - Disable progress output - - -y - Disable confirmation prompt. - - --default-host - Choose a default host triple - - --default-toolchain - 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 - - --no-update-default-toolchain - Don't update any existing default toolchain after install - - --no-modify-path - Don't configure the PATH environment variable - - -h, --help - Print help information +The installer for rustup - -V, --version - Print version information +Usage: rustup-init[EXE] [OPTIONS] + +Options: + -v, --verbose + Enable verbose output + -q, --quiet + Disable progress output + -y + Disable confirmation prompt. + --default-host + Choose a default host triple + --default-toolchain + 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 + --no-update-default-toolchain + Don't update any existing default toolchain after install + --no-modify-path + Don't configure the PATH environment variable + -h, --help + Print help + -V, --version + Print version """ stderr = "" 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 706f9ec3c6..bddf924bb5 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 @@ -3,46 +3,35 @@ args = ["--help"] status.code = 0 stdout = """ rustup-init [..] -The installer for rustup - -USAGE: - rustup-init[EXE] [OPTIONS] - -OPTIONS: - -v, --verbose - Enable verbose output - - -q, --quiet - Disable progress output - - -y - Disable confirmation prompt. - - --default-host - Choose a default host triple - - --default-toolchain - 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 - - --no-update-default-toolchain - Don't update any existing default toolchain after install - - --no-modify-path - Don't configure the PATH environment variable - - -h, --help - Print help information +The installer for rustup - -V, --version - Print version information +Usage: rustup-init[EXE] [OPTIONS] + +Options: + -v, --verbose + Enable verbose output + -q, --quiet + Disable progress output + -y + Disable confirmation prompt. + --default-host + Choose a default host triple + --default-toolchain + 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 + --no-update-default-toolchain + Don't update any existing default toolchain after install + --no-modify-path + Don't configure the PATH environment variable + -h, --help + Print help + -V, --version + Print version """ stderr = "" diff --git a/tests/suite/cli-ui/rustup/rustup_check_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_check_cmd_help_flag_stdout.toml index 793768eb60..86cc59070b 100644 --- a/tests/suite/cli-ui/rustup/rustup_check_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_check_cmd_help_flag_stdout.toml @@ -4,10 +4,9 @@ stdout = """ ... Check for updates to Rust toolchains and rustup -USAGE: - rustup[EXE] check +Usage: rustup[EXE] check -OPTIONS: - -h, --help Print help information +Options: + -h, --help Print help """ stderr = "" diff --git a/tests/suite/cli-ui/rustup/rustup_completions_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_completions_cmd_help_flag_stdout.toml index 309ed062fe..63ac522164 100644 --- a/tests/suite/cli-ui/rustup/rustup_completions_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_completions_cmd_help_flag_stdout.toml @@ -4,17 +4,16 @@ stdout = """ ... Generate tab-completion scripts for your shell -USAGE: - rustup[EXE] completions [ARGS] +Usage: rustup[EXE] completions [shell] [command] -ARGS: - [possible values: bash, elvish, fish, powershell, zsh] - [possible values: rustup, cargo] +Arguments: + [shell] [possible values: bash, elvish, fish, powershell, zsh] + [command] [possible values: rustup, cargo] -OPTIONS: - -h, --help Print help information +Options: + -h, --help Print help -DISCUSSION: +Discussion: Enable tab completion for Bash, Fish, Zsh, or PowerShell The script is output on `stdout`, allowing one to re-direct the output to the file of their choosing. Where you place the file @@ -25,7 +24,7 @@ DISCUSSION: Here are some common set ups for the three supported shells under Unix and similar operating systems (such as GNU/Linux). - BASH: + Bash: Completion files are commonly stored in `/etc/bash_completion.d/` for system-wide commands, but can be stored in @@ -38,7 +37,7 @@ DISCUSSION: This installs the completion script. You may have to log out and log back in to your shell session for the changes to take effect. - BASH (macOS/Homebrew): + Bash (macOS/Homebrew): Homebrew stores bash completion files within the Homebrew directory. With the `bash-completion` brew formula installed, run the command: @@ -46,7 +45,7 @@ DISCUSSION: $ mkdir -p $(brew --prefix)/etc/bash_completion.d $ rustup completions bash > $(brew --prefix)/etc/bash_completion.d/rustup.bash-completion - FISH: + Fish: Fish completion files are commonly stored in `$HOME/.config/fish/completions`. Run the command: @@ -57,7 +56,7 @@ DISCUSSION: This installs the completion script. You may have to log out and log back in to your shell session for the changes to take effect. - ZSH: + Zsh: ZSH completions are commonly stored in any directory listed in your `$fpath` variable. To use these completions, you must either @@ -87,7 +86,7 @@ DISCUSSION: for the new completions to take effect. - CUSTOM LOCATIONS: + Custom locations: Alternatively, you could save these files to the place of your choosing, such as a custom directory inside your $HOME. Doing so @@ -95,7 +94,7 @@ DISCUSSION: inside your login script. Consult your shells documentation for how to add such directives. - POWERSHELL: + PowerShell: The powershell completion scripts require PowerShell v5.0+ (which comes with Windows 10, but can be downloaded separately for windows 7 @@ -118,20 +117,20 @@ DISCUSSION: completions into our profile simply use PS C:/> rustup completions powershell >> -${env:USERPROFILE}/Documents/WindowsPowerShell/Microsoft.PowerShell_profile.ps1 + ${env:USERPROFILE}/Documents/WindowsPowerShell/Microsoft.PowerShell_profile.ps1 - CARGO: + Cargo: Rustup can also generate a completion script for `cargo`. The script output by `rustup` will source the completion script distributed with your default toolchain. Not all shells are currently supported. Here are examples for the currently supported shells. - BASH: + Bash: $ rustup completions bash cargo >> ~/.local/share/bash-completion/completions/cargo - ZSH: + Zsh: $ rustup completions zsh cargo > ~/.zfunc/_cargo """ diff --git a/tests/suite/cli-ui/rustup/rustup_component_cmd_add_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_component_cmd_add_cmd_help_flag_stdout.toml index 2dbd6b2192..e7c25e2bac 100644 --- a/tests/suite/cli-ui/rustup/rustup_component_cmd_add_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_component_cmd_add_cmd_help_flag_stdout.toml @@ -4,16 +4,15 @@ stdout = """ ... Add a component to a Rust toolchain -USAGE: - rustup[EXE] component add [OPTIONS] ... +Usage: rustup[EXE] component add [OPTIONS] ... -ARGS: - ... +Arguments: + ... -OPTIONS: - --toolchain Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more - information see `rustup help toolchain` - --target - -h, --help Print help information +Options: + --toolchain Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more + information see `rustup help toolchain` + --target + -h, --help Print help """ stderr = "" diff --git a/tests/suite/cli-ui/rustup/rustup_component_cmd_list_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_component_cmd_list_cmd_help_flag_stdout.toml index 221c90dcfa..b4f5d20398 100644 --- a/tests/suite/cli-ui/rustup/rustup_component_cmd_list_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_component_cmd_list_cmd_help_flag_stdout.toml @@ -4,13 +4,12 @@ stdout = """ ... List installed and available components -USAGE: - rustup[EXE] component list [OPTIONS] +Usage: rustup[EXE] component list [OPTIONS] -OPTIONS: - --toolchain Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more - information see `rustup help toolchain` - --installed List only installed components - -h, --help Print help information +Options: + --toolchain Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more + information see `rustup help toolchain` + --installed List only installed components + -h, --help Print help """ stderr = "" diff --git a/tests/suite/cli-ui/rustup/rustup_component_cmd_remove_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_component_cmd_remove_cmd_help_flag_stdout.toml index 917b72b041..226db0a7ea 100644 --- a/tests/suite/cli-ui/rustup/rustup_component_cmd_remove_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_component_cmd_remove_cmd_help_flag_stdout.toml @@ -4,16 +4,15 @@ stdout = """ ... Remove a component from a Rust toolchain -USAGE: - rustup[EXE] component remove [OPTIONS] ... +Usage: rustup[EXE] component remove [OPTIONS] ... -ARGS: - ... +Arguments: + ... -OPTIONS: - --toolchain Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more - information see `rustup help toolchain` - --target - -h, --help Print help information +Options: + --toolchain Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more + information see `rustup help toolchain` + --target + -h, --help Print help """ stderr = "" diff --git a/tests/suite/cli-ui/rustup/rustup_default_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_default_cmd_help_flag_stdout.toml index cd47e4f43c..cd85c265b7 100644 --- a/tests/suite/cli-ui/rustup/rustup_default_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_default_cmd_help_flag_stdout.toml @@ -4,17 +4,16 @@ stdout = """ ... Set the default toolchain -USAGE: - rustup[EXE] default [toolchain] +Usage: rustup[EXE] default [toolchain] -ARGS: - 'none', a toolchain name, such as 'stable', 'nightly', '1.8.0', or a custom - toolchain name. For more information see `rustup help toolchain` +Arguments: + [toolchain] 'none', a toolchain name, such as 'stable', 'nightly', '1.8.0', or a custom toolchain + name. For more information see `rustup help toolchain` -OPTIONS: - -h, --help Print help information +Options: + -h, --help Print help -DISCUSSION: +Discussion: Sets the default toolchain to the one specified. If the toolchain is not already installed then it is installed first. """ diff --git a/tests/suite/cli-ui/rustup/rustup_doc_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_doc_cmd_help_flag_stdout.toml index ec12561e41..d9698f2820 100644 --- a/tests/suite/cli-ui/rustup/rustup_doc_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_doc_cmd_help_flag_stdout.toml @@ -4,38 +4,37 @@ stdout = """ ... Open the documentation for the current toolchain -USAGE: - rustup[EXE] doc [OPTIONS] [topic] +Usage: rustup[EXE] doc [OPTIONS] [topic] -ARGS: - Topic such as 'core', 'fn', 'usize', 'eprintln!', 'core::arch', 'alloc::format!', - 'std::fs', 'std::fs::read_dir', 'std::io::Bytes', 'std::iter::Sum', - 'std::io::error::Result' etc... +Arguments: + [topic] Topic such as 'core', 'fn', 'usize', 'eprintln!', 'core::arch', 'alloc::format!', + 'std::fs', 'std::fs::read_dir', 'std::io::Bytes', 'std::iter::Sum', + 'std::io::error::Result' etc... -OPTIONS: - --path Only print the path to the documentation - --toolchain Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more - information see `rustup help toolchain` - --alloc The Rust core allocation and collections library - --book The Rust Programming Language book - --cargo The Cargo Book - --core The Rust Core Library - --edition-guide The Rust Edition Guide - --nomicon The Dark Arts of Advanced and Unsafe Rust Programming - --proc_macro A support library for macro authors when defining new macros - --reference The Rust Reference - --rust-by-example A collection of runnable examples that illustrate various Rust - concepts and standard libraries - --rustc The compiler for the Rust programming language - --rustdoc Documentation generator for Rust projects - --std Standard library API documentation - --test Support code for rustc's built in unit-test and - micro-benchmarking framework - --unstable-book The Unstable Book - --embedded-book The Embedded Rust Book - -h, --help Print help information +Options: + --path Only print the path to the documentation + --toolchain Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more + information see `rustup help toolchain` + --alloc The Rust core allocation and collections library + --book The Rust Programming Language book + --cargo The Cargo Book + --core The Rust Core Library + --edition-guide The Rust Edition Guide + --nomicon The Dark Arts of Advanced and Unsafe Rust Programming + --proc_macro A support library for macro authors when defining new macros + --reference The Rust Reference + --rust-by-example A collection of runnable examples that illustrate various Rust + concepts and standard libraries + --rustc The compiler for the Rust programming language + --rustdoc Documentation generator for Rust projects + --std Standard library API documentation + --test Support code for rustc's built in unit-test and micro-benchmarking + framework + --unstable-book The Unstable Book + --embedded-book The Embedded Rust Book + -h, --help Print help -DISCUSSION: +Discussion: Opens the documentation for the currently active toolchain with the default browser. diff --git a/tests/suite/cli-ui/rustup/rustup_help_cmd_stdout.toml b/tests/suite/cli-ui/rustup/rustup_help_cmd_stdout.toml index 68caeb20d7..791eb0fcf3 100644 --- a/tests/suite/cli-ui/rustup/rustup_help_cmd_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_help_cmd_stdout.toml @@ -3,39 +3,39 @@ args = ["help"] status.code = 0 stdout = """ rustup [..] + The Rust toolchain installer -USAGE: - rustup[EXE] [OPTIONS] [+toolchain] +Usage: rustup[EXE] [OPTIONS] [+toolchain] [COMMAND] -ARGS: - <+toolchain> release channel (e.g. +stable) or custom toolchain to set override +Commands: + show Show the active and installed toolchains or profiles + update Update Rust toolchains and rustup + check Check for updates to Rust toolchains and rustup + default Set the default toolchain + toolchain Modify or query the installed toolchains + target Modify a toolchain's supported targets + component Modify a toolchain's installed components + override Modify directory toolchain overrides + run Run a command with an environment configured for a given toolchain + which Display which binary will be run for a given command + doc Open the documentation for the current toolchain +... + self Modify the rustup installation + set Alter rustup settings + completions Generate tab-completion scripts for your shell + help Print this message or the help of the given subcommand(s) -OPTIONS: - -v, --verbose Enable verbose output - -q, --quiet Disable progress output - -h, --help Print help information - -V, --version Print version information +Arguments: + [+toolchain] release channel (e.g. +stable) or custom toolchain to set override -SUBCOMMANDS: - show Show the active and installed toolchains or profiles - update Update Rust toolchains and rustup - check Check for updates to Rust toolchains and rustup - default Set the default toolchain - toolchain Modify or query the installed toolchains - target Modify a toolchain's supported targets - component Modify a toolchain's installed components - override Modify directory toolchain overrides - run Run a command with an environment configured for a given toolchain - which Display which binary will be run for a given command - doc Open the documentation for the current toolchain -... - self Modify the rustup installation - set Alter rustup settings - completions Generate tab-completion scripts for your shell - help Print this message or the help of the given subcommand(s) +Options: + -v, --verbose Enable verbose output + -q, --quiet Disable progress output + -h, --help Print help + -V, --version Print version -DISCUSSION: +Discussion: Rustup installs The Rust Programming Language from the official release channels, enabling you to easily switch between stable, beta, and nightly compilers and keep them updated. It makes diff --git a/tests/suite/cli-ui/rustup/rustup_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_help_flag_stdout.toml index c0f051e22a..b93ab136ec 100644 --- a/tests/suite/cli-ui/rustup/rustup_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_help_flag_stdout.toml @@ -3,39 +3,39 @@ args = ["--help"] status.code = 0 stdout = """ rustup [..] + The Rust toolchain installer -USAGE: - rustup[EXE] [OPTIONS] [+toolchain] +Usage: rustup[EXE] [OPTIONS] [+toolchain] [COMMAND] -ARGS: - <+toolchain> release channel (e.g. +stable) or custom toolchain to set override +Commands: + show Show the active and installed toolchains or profiles + update Update Rust toolchains and rustup + check Check for updates to Rust toolchains and rustup + default Set the default toolchain + toolchain Modify or query the installed toolchains + target Modify a toolchain's supported targets + component Modify a toolchain's installed components + override Modify directory toolchain overrides + run Run a command with an environment configured for a given toolchain + which Display which binary will be run for a given command + doc Open the documentation for the current toolchain +... + self Modify the rustup installation + set Alter rustup settings + completions Generate tab-completion scripts for your shell + help Print this message or the help of the given subcommand(s) -OPTIONS: - -v, --verbose Enable verbose output - -q, --quiet Disable progress output - -h, --help Print help information - -V, --version Print version information +Arguments: + [+toolchain] release channel (e.g. +stable) or custom toolchain to set override -SUBCOMMANDS: - show Show the active and installed toolchains or profiles - update Update Rust toolchains and rustup - check Check for updates to Rust toolchains and rustup - default Set the default toolchain - toolchain Modify or query the installed toolchains - target Modify a toolchain's supported targets - component Modify a toolchain's installed components - override Modify directory toolchain overrides - run Run a command with an environment configured for a given toolchain - which Display which binary will be run for a given command - doc Open the documentation for the current toolchain -... - self Modify the rustup installation - set Alter rustup settings - completions Generate tab-completion scripts for your shell - help Print this message or the help of the given subcommand(s) +Options: + -v, --verbose Enable verbose output + -q, --quiet Disable progress output + -h, --help Print help + -V, --version Print version -DISCUSSION: +Discussion: Rustup installs The Rust Programming Language from the official release channels, enabling you to easily switch between stable, beta, and nightly compilers and keep them updated. It makes diff --git a/tests/suite/cli-ui/rustup/rustup_man_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_man_cmd_help_flag_stdout.toml index 6ec2336396..5c94c51058 100644 --- a/tests/suite/cli-ui/rustup/rustup_man_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_man_cmd_help_flag_stdout.toml @@ -4,15 +4,14 @@ stdout = """ ... View the man page for a given command -USAGE: - rustup[EXE] man [OPTIONS] +Usage: rustup[EXE] man [OPTIONS] -ARGS: - +Arguments: + -OPTIONS: - --toolchain Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more - information see `rustup help toolchain` - -h, --help Print help information +Options: + --toolchain Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more + information see `rustup help toolchain` + -h, --help Print help """ stderr = "" diff --git a/tests/suite/cli-ui/rustup/rustup_only_options_stdout.toml b/tests/suite/cli-ui/rustup/rustup_only_options_stdout.toml index e7d2600424..1b24ddd30a 100644 --- a/tests/suite/cli-ui/rustup/rustup_only_options_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_only_options_stdout.toml @@ -1,41 +1,49 @@ +args = ["-q"] bin.name = "rustup" -args = ["-v"] status.code = 1 -stdout = """ +stderr = """ rustup [..] + The Rust toolchain installer -USAGE: - rustup[EXE] [OPTIONS] [+toolchain] - -ARGS: - <+toolchain> release channel (e.g. +stable) or custom toolchain to set override - -OPTIONS: - -v, --verbose Enable verbose output - -q, --quiet Disable progress output - -h, --help Print help information - -V, --version Print version information - -SUBCOMMANDS: - show Show the active and installed toolchains or profiles - update Update Rust toolchains and rustup - check Check for updates to Rust toolchains and rustup - default Set the default toolchain - toolchain Modify or query the installed toolchains - target Modify a toolchain's supported targets - component Modify a toolchain's installed components - override Modify directory toolchain overrides - run Run a command with an environment configured for a given toolchain - which Display which binary will be run for a given command - doc Open the documentation for the current toolchain +Usage: rustup [OPTIONS] [+toolchain] [COMMAND] + +Commands: + show Show the active and installed toolchains or profiles + update Update Rust toolchains and rustup + check Check for updates to Rust toolchains and rustup + default Set the default toolchain + toolchain Modify or query the installed toolchains + target Modify a toolchain's supported targets + component Modify a toolchain's installed components + override Modify directory toolchain overrides + run Run a command with an environment configured for a given toolchain + which Display which binary will be run for a given command + doc Open the documentation for the current toolchain ... - self Modify the rustup installation - set Alter rustup settings - completions Generate tab-completion scripts for your shell - help Print this message or the help of the given subcommand(s) + self Modify the rustup installation + set Alter rustup settings + completions Generate tab-completion scripts for your shell + help Print this message or the help of the given subcommand(s) + +Arguments: + [+toolchain] + release channel (e.g. +stable) or custom toolchain to set override + +Options: + -v, --verbose + Enable verbose output -DISCUSSION: + -q, --quiet + Disable progress output + + -h, --help + Print help + + -V, --version + Print version + +Discussion: Rustup installs The Rust Programming Language from the official release channels, enabling you to easily switch between stable, beta, and nightly compilers and keep them updated. It makes @@ -44,5 +52,6 @@ DISCUSSION: If you are new to Rust consider running `rustup doc --book` to learn Rust. + """ -stderr = "" +stdout = "" diff --git a/tests/suite/cli-ui/rustup/rustup_override_cmd_add_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_override_cmd_add_cmd_help_flag_stdout.toml index 95a2e7da31..bf4b218daa 100644 --- a/tests/suite/cli-ui/rustup/rustup_override_cmd_add_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_override_cmd_add_cmd_help_flag_stdout.toml @@ -4,15 +4,14 @@ stdout = """ ... Set the override toolchain for a directory -USAGE: - rustup[EXE] override set [OPTIONS] +Usage: rustup[EXE] override set [OPTIONS] -ARGS: - Toolchain name, such as 'stable', 'nightly', '1.8.0', or a custom toolchain - name. For more information see `rustup help toolchain` +Arguments: + Toolchain name, such as 'stable', 'nightly', '1.8.0', or a custom toolchain name. For + more information see `rustup help toolchain` -OPTIONS: - --path Path to the directory - -h, --help Print help information +Options: + --path Path to the directory + -h, --help Print help """ stderr = "" diff --git a/tests/suite/cli-ui/rustup/rustup_override_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_override_cmd_help_flag_stdout.toml index 08b2daecbd..a9ae2a9f58 100644 --- a/tests/suite/cli-ui/rustup/rustup_override_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_override_cmd_help_flag_stdout.toml @@ -4,19 +4,18 @@ stdout = """ ... Modify directory toolchain overrides -USAGE: - rustup[EXE] override +Usage: rustup[EXE] override -OPTIONS: - -h, --help Print help information +Commands: + list List directory toolchain overrides + set Set the override toolchain for a directory + unset Remove the override toolchain for a directory + help Print this message or the help of the given subcommand(s) -SUBCOMMANDS: - list List directory toolchain overrides - set Set the override toolchain for a directory - unset Remove the override toolchain for a directory - help Print this message or the help of the given subcommand(s) +Options: + -h, --help Print help -DISCUSSION: +Discussion: Overrides configure Rustup to use a specific toolchain when running in a specific directory. diff --git a/tests/suite/cli-ui/rustup/rustup_override_cmd_list_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_override_cmd_list_cmd_help_flag_stdout.toml index 8116d71751..8d90aca23e 100644 --- a/tests/suite/cli-ui/rustup/rustup_override_cmd_list_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_override_cmd_list_cmd_help_flag_stdout.toml @@ -4,10 +4,9 @@ stdout = """ ... List directory toolchain overrides -USAGE: - rustup[EXE] override list +Usage: rustup[EXE] override list -OPTIONS: - -h, --help Print help information +Options: + -h, --help Print help """ stderr = "" diff --git a/tests/suite/cli-ui/rustup/rustup_override_cmd_remove_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_override_cmd_remove_cmd_help_flag_stdout.toml index 2bc53d6720..6af8bfc960 100644 --- a/tests/suite/cli-ui/rustup/rustup_override_cmd_remove_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_override_cmd_remove_cmd_help_flag_stdout.toml @@ -4,15 +4,14 @@ stdout = """ ... Remove the override toolchain for a directory -USAGE: - rustup[EXE] override unset [OPTIONS] +Usage: rustup[EXE] override unset [OPTIONS] -OPTIONS: - --path Path to the directory - --nonexistent Remove override toolchain for all nonexistent directories - -h, --help Print help information +Options: + --path Path to the directory + --nonexistent Remove override toolchain for all nonexistent directories + -h, --help Print help -DISCUSSION: +Discussion: If `--path` argument is present, removes the override toolchain for the specified directory. If `--nonexistent` argument is present, removes the override toolchain for all nonexistent diff --git a/tests/suite/cli-ui/rustup/rustup_override_cmd_set_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_override_cmd_set_cmd_help_flag_stdout.toml index e8c9ead5c0..462d4a3d46 100644 --- a/tests/suite/cli-ui/rustup/rustup_override_cmd_set_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_override_cmd_set_cmd_help_flag_stdout.toml @@ -4,15 +4,14 @@ stdout = """ ... Set the override toolchain for a directory -USAGE: - rustup[EXE] override set [OPTIONS] +Usage: rustup[EXE] override set [OPTIONS] -ARGS: - Toolchain name, such as 'stable', 'nightly', '1.8.0', or a custom toolchain - name. For more information see `rustup help toolchain` +Arguments: + Toolchain name, such as 'stable', 'nightly', '1.8.0', or a custom toolchain name. For + more information see `rustup help toolchain` -OPTIONS: - --path Path to the directory - -h, --help Print help information +Options: + --path Path to the directory + -h, --help Print help """ stderr = "" diff --git a/tests/suite/cli-ui/rustup/rustup_override_cmd_unset_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_override_cmd_unset_cmd_help_flag_stdout.toml index 2bc53d6720..6af8bfc960 100644 --- a/tests/suite/cli-ui/rustup/rustup_override_cmd_unset_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_override_cmd_unset_cmd_help_flag_stdout.toml @@ -4,15 +4,14 @@ stdout = """ ... Remove the override toolchain for a directory -USAGE: - rustup[EXE] override unset [OPTIONS] +Usage: rustup[EXE] override unset [OPTIONS] -OPTIONS: - --path Path to the directory - --nonexistent Remove override toolchain for all nonexistent directories - -h, --help Print help information +Options: + --path Path to the directory + --nonexistent Remove override toolchain for all nonexistent directories + -h, --help Print help -DISCUSSION: +Discussion: If `--path` argument is present, removes the override toolchain for the specified directory. If `--nonexistent` argument is present, removes the override toolchain for all nonexistent diff --git a/tests/suite/cli-ui/rustup/rustup_run_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_run_cmd_help_flag_stdout.toml index 0760ac3465..649ec2db53 100644 --- a/tests/suite/cli-ui/rustup/rustup_run_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_run_cmd_help_flag_stdout.toml @@ -5,19 +5,18 @@ stdout = """ ... Run a command with an environment configured for a given toolchain -USAGE: - rustup[EXE] run [OPTIONS] ... +Usage: rustup[EXE] run [OPTIONS] ... -ARGS: - Toolchain name, such as 'stable', 'nightly', '1.8.0', or a custom toolchain - name, or an absolute path. For more information see `rustup help toolchain` - ... +Arguments: + Toolchain name, such as 'stable', 'nightly', '1.8.0', or a custom toolchain name, or + an absolute path. For more information see `rustup help toolchain` + ... -OPTIONS: - --install Install the requested toolchain if needed - -h, --help Print help information +Options: + --install Install the requested toolchain if needed + -h, --help Print help -DISCUSSION: +Discussion: Configures an environment to use the given toolchain and then runs the specified program. The command may be any program, not just rustc or cargo. This can be used for testing arbitrary toolchains diff --git a/tests/suite/cli-ui/rustup/rustup_self_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_self_cmd_help_flag_stdout.toml index 9c0ff9d9c3..966d1c1917 100644 --- a/tests/suite/cli-ui/rustup/rustup_self_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_self_cmd_help_flag_stdout.toml @@ -4,16 +4,15 @@ stdout = """ ... Modify the rustup installation -USAGE: - rustup[EXE] self +Usage: rustup[EXE] self -OPTIONS: - -h, --help Print help information +Commands: + update Download and install updates to rustup + uninstall Uninstall rustup. + upgrade-data Upgrade the internal data format. + help Print this message or the help of the given subcommand(s) -SUBCOMMANDS: - update Download and install updates to rustup - uninstall Uninstall rustup. - upgrade-data Upgrade the internal data format. - help Print this message or the help of the given subcommand(s) +Options: + -h, --help Print help """ stderr = "" diff --git a/tests/suite/cli-ui/rustup/rustup_self_cmd_uninstall_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_self_cmd_uninstall_cmd_help_flag_stdout.toml index 28628dcd3a..d8bbc2ad57 100644 --- a/tests/suite/cli-ui/rustup/rustup_self_cmd_uninstall_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_self_cmd_uninstall_cmd_help_flag_stdout.toml @@ -4,11 +4,10 @@ stdout = """ ... Uninstall rustup. -USAGE: - rustup[EXE] self uninstall [OPTIONS] +Usage: rustup[EXE] self uninstall [OPTIONS] -OPTIONS: - -y - -h, --help Print help information +Options: + -y + -h, --help Print help """ stderr = "" diff --git a/tests/suite/cli-ui/rustup/rustup_self_cmd_update_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_self_cmd_update_cmd_help_flag_stdout.toml index cbd215987a..e5472f2783 100644 --- a/tests/suite/cli-ui/rustup/rustup_self_cmd_update_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_self_cmd_update_cmd_help_flag_stdout.toml @@ -4,10 +4,9 @@ stdout = """ ... Download and install updates to rustup -USAGE: - rustup[EXE] self update +Usage: rustup[EXE] self update -OPTIONS: - -h, --help Print help information +Options: + -h, --help Print help """ stderr = "" diff --git a/tests/suite/cli-ui/rustup/rustup_self_cmd_upgrade-data _cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_self_cmd_upgrade-data _cmd_help_flag_stdout.toml index c06b9a03f9..01f1c4bdd8 100644 --- a/tests/suite/cli-ui/rustup/rustup_self_cmd_upgrade-data _cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_self_cmd_upgrade-data _cmd_help_flag_stdout.toml @@ -4,10 +4,9 @@ stdout = """ ... Upgrade the internal data format. -USAGE: - rustup[EXE] self upgrade-data +Usage: rustup[EXE] self upgrade-data -OPTIONS: - -h, --help Print help information +Options: + -h, --help Print help """ stderr = "" diff --git a/tests/suite/cli-ui/rustup/rustup_set_cmd_auto-self-update_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_set_cmd_auto-self-update_cmd_help_flag_stdout.toml index 0bcce67e6f..854c81ad69 100644 --- a/tests/suite/cli-ui/rustup/rustup_set_cmd_auto-self-update_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_set_cmd_auto-self-update_cmd_help_flag_stdout.toml @@ -4,13 +4,12 @@ stdout = """ ... The rustup auto self update mode -USAGE: - rustup[EXE] set auto-self-update +Usage: rustup[EXE] set auto-self-update -ARGS: - [default: enable] [possible values: enable, disable, check-only] +Arguments: + [default: enable] [possible values: enable, disable, check-only] -OPTIONS: - -h, --help Print help information +Options: + -h, --help Print help """ stderr = "" diff --git a/tests/suite/cli-ui/rustup/rustup_set_cmd_default-host_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_set_cmd_default-host_cmd_help_flag_stdout.toml index 3b5a9421ad..bdab25cd07 100644 --- a/tests/suite/cli-ui/rustup/rustup_set_cmd_default-host_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_set_cmd_default-host_cmd_help_flag_stdout.toml @@ -4,13 +4,12 @@ stdout = """ ... The triple used to identify toolchains when not specified -USAGE: - rustup[EXE] set default-host +Usage: rustup[EXE] set default-host -ARGS: - +Arguments: + -OPTIONS: - -h, --help Print help information +Options: + -h, --help Print help """ stderr = "" diff --git a/tests/suite/cli-ui/rustup/rustup_set_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_set_cmd_help_flag_stdout.toml index 8522656129..04ce4aaa5a 100644 --- a/tests/suite/cli-ui/rustup/rustup_set_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_set_cmd_help_flag_stdout.toml @@ -4,16 +4,15 @@ stdout = """ ... Alter rustup settings -USAGE: - rustup[EXE] set +Usage: rustup[EXE] set -OPTIONS: - -h, --help Print help information +Commands: + default-host The triple used to identify toolchains when not specified + profile The default components installed + auto-self-update The rustup auto self update mode + help Print this message or the help of the given subcommand(s) -SUBCOMMANDS: - default-host The triple used to identify toolchains when not specified - profile The default components installed - auto-self-update The rustup auto self update mode - help Print this message or the help of the given subcommand(s) +Options: + -h, --help Print help """ stderr = "" diff --git a/tests/suite/cli-ui/rustup/rustup_set_cmd_profile_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_set_cmd_profile_cmd_help_flag_stdout.toml index 7013e21433..d92d750e17 100644 --- a/tests/suite/cli-ui/rustup/rustup_set_cmd_profile_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_set_cmd_profile_cmd_help_flag_stdout.toml @@ -4,13 +4,12 @@ stdout = """ ... The default components installed -USAGE: - rustup[EXE] set profile +Usage: rustup[EXE] set profile -ARGS: - [default: default] [possible values: minimal, default, complete] +Arguments: + [default: default] [possible values: minimal, default, complete] -OPTIONS: - -h, --help Print help information +Options: + -h, --help Print help """ stderr = "" diff --git a/tests/suite/cli-ui/rustup/rustup_show_cmd_active-toolchain_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_show_cmd_active-toolchain_cmd_help_flag_stdout.toml index 0bd8de5fe5..006f8e3f7f 100644 --- a/tests/suite/cli-ui/rustup/rustup_show_cmd_active-toolchain_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_show_cmd_active-toolchain_cmd_help_flag_stdout.toml @@ -4,14 +4,13 @@ stdout = """ ... Show the active toolchain -USAGE: - rustup[EXE] show active-toolchain [OPTIONS] +Usage: rustup[EXE] show active-toolchain [OPTIONS] -OPTIONS: - -v, --verbose Enable verbose output with rustc information - -h, --help Print help information +Options: + -v, --verbose Enable verbose output with rustc information + -h, --help Print help -DISCUSSION: +Discussion: Shows the name of the active toolchain. This is useful for figuring out the active tool chain from diff --git a/tests/suite/cli-ui/rustup/rustup_show_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_show_cmd_help_flag_stdout.toml index fa05eee33a..b69b13990d 100644 --- a/tests/suite/cli-ui/rustup/rustup_show_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_show_cmd_help_flag_stdout.toml @@ -4,20 +4,19 @@ stdout = """ ... Show the active and installed toolchains or profiles -USAGE: - rustup[EXE] show [OPTIONS] [SUBCOMMAND] +Usage: rustup[EXE] show [OPTIONS] [COMMAND] -OPTIONS: - -v, --verbose Enable verbose output with rustc information for all installed toolchains - -h, --help Print help information +Commands: + active-toolchain Show the active toolchain + home Display the computed value of RUSTUP_HOME + profile Show the current profile + help Print this message or the help of the given subcommand(s) -SUBCOMMANDS: - active-toolchain Show the active toolchain - home Display the computed value of RUSTUP_HOME - profile Show the current profile - help Print this message or the help of the given subcommand(s) +Options: + -v, --verbose Enable verbose output with rustc information for all installed toolchains + -h, --help Print help -DISCUSSION: +Discussion: Shows the name of the active toolchain and the version of `rustc`. If the active toolchain has installed support for additional diff --git a/tests/suite/cli-ui/rustup/rustup_show_cmd_home_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_show_cmd_home_cmd_help_flag_stdout.toml index a852be1033..b98cb165c3 100644 --- a/tests/suite/cli-ui/rustup/rustup_show_cmd_home_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_show_cmd_home_cmd_help_flag_stdout.toml @@ -4,10 +4,9 @@ stdout = """ ... Display the computed value of RUSTUP_HOME -USAGE: - rustup[EXE] show home +Usage: rustup[EXE] show home -OPTIONS: - -h, --help Print help information +Options: + -h, --help Print help """ stderr = "" diff --git a/tests/suite/cli-ui/rustup/rustup_show_cmd_profile_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_show_cmd_profile_cmd_help_flag_stdout.toml index 32ec3e8347..af20a30cbc 100644 --- a/tests/suite/cli-ui/rustup/rustup_show_cmd_profile_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_show_cmd_profile_cmd_help_flag_stdout.toml @@ -4,10 +4,9 @@ stdout = """ ... Show the current profile -USAGE: - rustup[EXE] show profile +Usage: rustup[EXE] show profile -OPTIONS: - -h, --help Print help information +Options: + -h, --help Print help """ stderr = "" diff --git a/tests/suite/cli-ui/rustup/rustup_target_cmd_add_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_target_cmd_add_cmd_help_flag_stdout.toml index 688b6f428e..c7b55dc104 100644 --- a/tests/suite/cli-ui/rustup/rustup_target_cmd_add_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_target_cmd_add_cmd_help_flag_stdout.toml @@ -4,15 +4,14 @@ stdout = """ ... Add a target to a Rust toolchain -USAGE: - rustup[EXE] target add [OPTIONS] ... +Usage: rustup[EXE] target add [OPTIONS] ... -ARGS: - ... List of targets to install; \"all\" installs all available targets +Arguments: + ... List of targets to install; \"all\" installs all available targets -OPTIONS: - --toolchain Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more - information see `rustup help toolchain` - -h, --help Print help information +Options: + --toolchain Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more + information see `rustup help toolchain` + -h, --help Print help """ stderr = "" diff --git a/tests/suite/cli-ui/rustup/rustup_target_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_target_cmd_help_flag_stdout.toml index 4872b92191..a1b723e37c 100644 --- a/tests/suite/cli-ui/rustup/rustup_target_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_target_cmd_help_flag_stdout.toml @@ -4,16 +4,15 @@ stdout = """ ... Modify a toolchain's supported targets -USAGE: - rustup[EXE] target +Usage: rustup[EXE] target -OPTIONS: - -h, --help Print help information +Commands: + list List installed and available targets + add Add a target to a Rust toolchain + remove Remove a target from a Rust toolchain + help Print this message or the help of the given subcommand(s) -SUBCOMMANDS: - list List installed and available targets - add Add a target to a Rust toolchain - remove Remove a target from a Rust toolchain - help Print this message or the help of the given subcommand(s) +Options: + -h, --help Print help """ stderr = "" diff --git a/tests/suite/cli-ui/rustup/rustup_target_cmd_list_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_target_cmd_list_cmd_help_flag_stdout.toml index 07691abfc5..6457da2ae7 100644 --- a/tests/suite/cli-ui/rustup/rustup_target_cmd_list_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_target_cmd_list_cmd_help_flag_stdout.toml @@ -4,13 +4,12 @@ stdout = """ ... List installed and available targets -USAGE: - rustup[EXE] target list [OPTIONS] +Usage: rustup[EXE] target list [OPTIONS] -OPTIONS: - --toolchain Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more - information see `rustup help toolchain` - --installed List only installed targets - -h, --help Print help information +Options: + --toolchain Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more + information see `rustup help toolchain` + --installed List only installed targets + -h, --help Print help """ stderr = "" diff --git a/tests/suite/cli-ui/rustup/rustup_target_cmd_remove_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_target_cmd_remove_cmd_help_flag_stdout.toml index 60abfefede..990f21ba8e 100644 --- a/tests/suite/cli-ui/rustup/rustup_target_cmd_remove_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_target_cmd_remove_cmd_help_flag_stdout.toml @@ -4,15 +4,14 @@ stdout = """ ... Remove a target from a Rust toolchain -USAGE: - rustup[EXE] target remove [OPTIONS] ... +Usage: rustup[EXE] target remove [OPTIONS] ... -ARGS: - ... List of targets to uninstall +Arguments: + ... List of targets to uninstall -OPTIONS: - --toolchain Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more - information see `rustup help toolchain` - -h, --help Print help information +Options: + --toolchain Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more + information see `rustup help toolchain` + -h, --help Print help """ stderr = "" diff --git a/tests/suite/cli-ui/rustup/rustup_toolchain_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_toolchain_cmd_help_flag_stdout.toml index a555542b27..87bcb893b6 100644 --- a/tests/suite/cli-ui/rustup/rustup_toolchain_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_toolchain_cmd_help_flag_stdout.toml @@ -4,20 +4,19 @@ stdout = """ ... Modify or query the installed toolchains -USAGE: - rustup[EXE] toolchain +Usage: rustup[EXE] toolchain -OPTIONS: - -h, --help Print help information +Commands: + list List installed toolchains + install Install or update a given toolchain + uninstall Uninstall a toolchain + link Create a custom toolchain by symlinking to a directory + help Print this message or the help of the given subcommand(s) -SUBCOMMANDS: - list List installed toolchains - install Install or update a given toolchain - uninstall Uninstall a toolchain - link Create a custom toolchain by symlinking to a directory - help Print this message or the help of the given subcommand(s) +Options: + -h, --help Print help -DISCUSSION: +Discussion: Many `rustup` commands deal with *toolchains*, a single installation of the Rust compiler. `rustup` supports multiple types of toolchains. The most basic track the official release 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 b3769d1b48..e02a1e4bd7 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 @@ -4,24 +4,23 @@ stdout = """ ... Install or update a given toolchain -USAGE: - rustup[EXE] toolchain install [OPTIONS] ... +Usage: rustup[EXE] toolchain install [OPTIONS] ... -ARGS: - ... Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more - information see `rustup help toolchain` +Arguments: + ... Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see + `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 information +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 """ stderr = "" diff --git a/tests/suite/cli-ui/rustup/rustup_toolchain_cmd_link_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_toolchain_cmd_link_cmd_help_flag_stdout.toml index e931c63ae3..77433e818e 100644 --- a/tests/suite/cli-ui/rustup/rustup_toolchain_cmd_link_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_toolchain_cmd_link_cmd_help_flag_stdout.toml @@ -4,17 +4,16 @@ stdout = """ ... Create a custom toolchain by symlinking to a directory -USAGE: - rustup[EXE] toolchain link +Usage: rustup[EXE] toolchain link -ARGS: - Custom toolchain name - Path to the directory +Arguments: + Custom toolchain name + Path to the directory -OPTIONS: - -h, --help Print help information +Options: + -h, --help Print help -DISCUSSION: +Discussion: 'toolchain' is the custom name to be assigned to the new toolchain. Any name is permitted as long as: - it does not include '/' or '/' except as the last character diff --git a/tests/suite/cli-ui/rustup/rustup_toolchain_cmd_list_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_toolchain_cmd_list_cmd_help_flag_stdout.toml index d2592440e9..bca9d63246 100644 --- a/tests/suite/cli-ui/rustup/rustup_toolchain_cmd_list_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_toolchain_cmd_list_cmd_help_flag_stdout.toml @@ -4,11 +4,10 @@ stdout = """ ... List installed toolchains -USAGE: - rustup[EXE] toolchain list [OPTIONS] +Usage: rustup[EXE] toolchain list [OPTIONS] -OPTIONS: - -v, --verbose Enable verbose output with toolchain information - -h, --help Print help information +Options: + -v, --verbose Enable verbose output with toolchain information + -h, --help Print help """ stderr = "" diff --git a/tests/suite/cli-ui/rustup/rustup_toolchain_cmd_uninstall_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_toolchain_cmd_uninstall_cmd_help_flag_stdout.toml index 08aa5aac0a..9776b801ff 100644 --- a/tests/suite/cli-ui/rustup/rustup_toolchain_cmd_uninstall_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_toolchain_cmd_uninstall_cmd_help_flag_stdout.toml @@ -4,14 +4,13 @@ stdout = """ ... Uninstall a toolchain -USAGE: - rustup[EXE] toolchain uninstall ... +Usage: rustup[EXE] toolchain uninstall ... -ARGS: - ... Toolchain name, such as 'stable', 'nightly', '1.8.0', or a custom - toolchain name. For more information see `rustup help toolchain` +Arguments: + ... Toolchain name, such as 'stable', 'nightly', '1.8.0', or a custom toolchain name. + For more information see `rustup help toolchain` -OPTIONS: - -h, --help Print help information +Options: + -h, --help Print help """ stderr = "" diff --git a/tests/suite/cli-ui/rustup/rustup_unknown_arg_stdout.toml b/tests/suite/cli-ui/rustup/rustup_unknown_arg_stdout.toml index f6e15c1276..aaa0365373 100644 --- a/tests/suite/cli-ui/rustup/rustup_unknown_arg_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_unknown_arg_stdout.toml @@ -3,7 +3,7 @@ args = ["random"] status.code = 1 stdout = "" stderr = """ -error: Invalid value \"random\" for '<+toolchain>': error: \"random\" is not a valid subcommand, so it was interpreted as a toolchain name, but it is also invalid. To override the toolchain using the 'rustup +toolchain' syntax, make sure to prefix the toolchain override with a '+' +error: invalid value 'random' for '[+toolchain]': error: \"random\" is not a valid subcommand, so it was interpreted as a toolchain name, but it is also invalid. To override the toolchain using the 'rustup +toolchain' syntax, make sure to prefix the toolchain override with a '+' -For more information try --help +For more information, try '--help'. """ diff --git a/tests/suite/cli-ui/rustup/rustup_up_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_up_cmd_help_flag_stdout.toml index e60aced4fd..cfe1cdb5f7 100644 --- a/tests/suite/cli-ui/rustup/rustup_up_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_up_cmd_help_flag_stdout.toml @@ -4,21 +4,20 @@ stdout = """ ... Update Rust toolchains and rustup -USAGE: - rustup[EXE] update [OPTIONS] [toolchain]... +Usage: rustup[EXE] update [OPTIONS] [toolchain]... -ARGS: - ... Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more - information see `rustup help toolchain` +Arguments: + [toolchain]... Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see + `rustup help toolchain` -OPTIONS: - --no-self-update Don't perform self update when running the `rustup update` command - --force Force an update, even if some components are missing - --force-non-host Install toolchains that require an emulator. See - https://github.com/rust-lang/rustup/wiki/Non-host-toolchains - -h, --help Print help information +Options: + --no-self-update Don't perform self update when running the `rustup update` command + --force Force an update, even if some components are missing + --force-non-host Install toolchains that require an emulator. See + https://github.com/rust-lang/rustup/wiki/Non-host-toolchains + -h, --help Print help -DISCUSSION: +Discussion: With no toolchain specified, the `update` command updates each of the installed toolchains from the official release channels, then updates rustup itself. diff --git a/tests/suite/cli-ui/rustup/rustup_update_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_update_cmd_help_flag_stdout.toml index 40ffc935f7..cdebda35ca 100644 --- a/tests/suite/cli-ui/rustup/rustup_update_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_update_cmd_help_flag_stdout.toml @@ -4,21 +4,20 @@ stdout = """ ... Update Rust toolchains and rustup -USAGE: - rustup[EXE] update [OPTIONS] [toolchain]... +Usage: rustup[EXE] update [OPTIONS] [toolchain]... -ARGS: - ... Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more - information see `rustup help toolchain` +Arguments: + [toolchain]... Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see + `rustup help toolchain` -OPTIONS: - --no-self-update Don't perform self update when running the `rustup update` command - --force Force an update, even if some components are missing - --force-non-host Install toolchains that require an emulator. See - https://github.com/rust-lang/rustup/wiki/Non-host-toolchains - -h, --help Print help information +Options: + --no-self-update Don't perform self update when running the `rustup update` command + --force Force an update, even if some components are missing + --force-non-host Install toolchains that require an emulator. See + https://github.com/rust-lang/rustup/wiki/Non-host-toolchains + -h, --help Print help -DISCUSSION: +Discussion: With no toolchain specified, the `update` command updates each of the installed toolchains from the official release channels, then updates rustup itself. diff --git a/tests/suite/cli-ui/rustup/rustup_upgrade_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_upgrade_cmd_help_flag_stdout.toml index 2153d7ecbf..11559534b4 100644 --- a/tests/suite/cli-ui/rustup/rustup_upgrade_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_upgrade_cmd_help_flag_stdout.toml @@ -4,21 +4,20 @@ stdout = """ ... Update Rust toolchains and rustup -USAGE: - rustup[EXE] update [OPTIONS] [toolchain]... +Usage: rustup[EXE] update [OPTIONS] [toolchain]... -ARGS: - ... Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more - information see `rustup help toolchain` +Arguments: + [toolchain]... Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see + `rustup help toolchain` -OPTIONS: - --no-self-update Don't perform self update when running the `rustup update` command - --force Force an update, even if some components are missing - --force-non-host Install toolchains that require an emulator. See - https://github.com/rust-lang/rustup/wiki/Non-host-toolchains - -h, --help Print help information +Options: + --no-self-update Don't perform self update when running the `rustup update` command + --force Force an update, even if some components are missing + --force-non-host Install toolchains that require an emulator. See + https://github.com/rust-lang/rustup/wiki/Non-host-toolchains + -h, --help Print help -DISCUSSION: +Discussion: With no toolchain specified, the `update` command updates each of the installed toolchains from the official release channels, then updates rustup itself. diff --git a/tests/suite/cli-ui/rustup/rustup_which_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_which_cmd_help_flag_stdout.toml index 799e5ae9af..4810dcbe27 100644 --- a/tests/suite/cli-ui/rustup/rustup_which_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_which_cmd_help_flag_stdout.toml @@ -5,14 +5,13 @@ stdout = """ ... Display which binary will be run for a given command -USAGE: - rustup[EXE] which [OPTIONS] +Usage: rustup[EXE] which [OPTIONS] -ARGS: - +Arguments: + -OPTIONS: - --toolchain Toolchain name, such as 'stable', 'nightly', '1.8.0', or a custom - toolchain name. For more information see `rustup help toolchain` - -h, --help Print help information +Options: + --toolchain Toolchain name, such as 'stable', 'nightly', '1.8.0', or a custom + toolchain name. For more information see `rustup help toolchain` + -h, --help Print help """ diff --git a/tests/suite/cli_misc.rs b/tests/suite/cli_misc.rs index 27f5f86152..4aaf5f76be 100644 --- a/tests/suite/cli_misc.rs +++ b/tests/suite/cli_misc.rs @@ -146,7 +146,7 @@ fn subcommand_required_for_target() { let out = cmd.output().unwrap(); assert!(!out.status.success()); assert_eq!(out.status.code().unwrap(), 1); - assert!(str::from_utf8(&out.stdout).unwrap().contains("USAGE")); + assert!(str::from_utf8(&out.stdout).unwrap().contains("Usage")); }); } @@ -160,7 +160,7 @@ fn subcommand_required_for_toolchain() { let out = cmd.output().unwrap(); assert!(!out.status.success()); assert_eq!(out.status.code().unwrap(), 1); - assert!(str::from_utf8(&out.stdout).unwrap().contains("USAGE")); + assert!(str::from_utf8(&out.stdout).unwrap().contains("Usage")); }); } @@ -174,7 +174,7 @@ fn subcommand_required_for_override() { let out = cmd.output().unwrap(); assert!(!out.status.success()); assert_eq!(out.status.code().unwrap(), 1); - assert!(str::from_utf8(&out.stdout).unwrap().contains("USAGE")); + assert!(str::from_utf8(&out.stdout).unwrap().contains("Usage")); }); } @@ -188,7 +188,7 @@ fn subcommand_required_for_self() { let out = cmd.output().unwrap(); assert!(!out.status.success()); assert_eq!(out.status.code().unwrap(), 1); - assert!(str::from_utf8(&out.stdout).unwrap().contains("USAGE")); + assert!(str::from_utf8(&out.stdout).unwrap().contains("Usage")); }); } @@ -806,11 +806,11 @@ fn completion_bad_shell() { setup(&|config| { config.expect_err( &["rustup", "completions", "fake"], - r#"error: "fake" isn't a valid value for ''"#, + r#"error: invalid value 'fake' for '[shell]'"#, ); config.expect_err( &["rustup", "completions", "fake", "cargo"], - r#"error: "fake" isn't a valid value for ''"#, + r#"error: invalid value 'fake' for '[shell]'"#, ); }); } @@ -820,7 +820,7 @@ fn completion_bad_tool() { setup(&|config| { config.expect_err( &["rustup", "completions", "bash", "fake"], - r#"error: "fake" isn't a valid value for ''"#, + r#"error: invalid value 'fake' for '[command]'"#, ); }); } diff --git a/tests/suite/cli_self_upd.rs b/tests/suite/cli_self_upd.rs index c21c99abc8..d67046c183 100644 --- a/tests/suite/cli_self_upd.rs +++ b/tests/suite/cli_self_upd.rs @@ -359,7 +359,7 @@ fn update_bogus_version() { config.expect_ok(&["rustup-init", "-y", "--no-modify-path"]); config.expect_err( &["rustup", "update", "1.0.0-alpha"], - "Invalid value \"1.0.0-alpha\" for '...': invalid toolchain name: '1.0.0-alpha'", + "invalid value '1.0.0-alpha' for '[toolchain]...': invalid toolchain name: '1.0.0-alpha'", ); }); } diff --git a/tests/suite/cli_ui.rs b/tests/suite/cli_ui.rs index b619ecf113..c5f66359d2 100644 --- a/tests/suite/cli_ui.rs +++ b/tests/suite/cli_ui.rs @@ -59,6 +59,9 @@ fn rustup_init_ui_doc_text_tests() { .unwrap(); // Make sure that the help output of rustup-init and rustup-init.sh are the same. - assert_eq!(rustup_init_help_std_out, rustup_init_sh_help_std_out) + assert_eq!( + rustup_init_help_std_out.stdout.unwrap(), + rustup_init_sh_help_std_out.stdout.unwrap() + ) } } diff --git a/tests/suite/cli_v2.rs b/tests/suite/cli_v2.rs index 4240298058..e892ac8048 100644 --- a/tests/suite/cli_v2.rs +++ b/tests/suite/cli_v2.rs @@ -797,7 +797,7 @@ fn cannot_add_empty_named_custom_toolchain() { let path = path.to_string_lossy(); config.expect_err( &["rustup", "toolchain", "link", "", &path], - "Invalid value \"\" for '': invalid toolchain name ''", + "invalid value '' for '': invalid toolchain name ''", ); }); }