diff --git a/rustup-init.sh b/rustup-init.sh index b7caccd98e8..de5c735bda9 100755 --- a/rustup-init.sh +++ b/rustup-init.sh @@ -41,7 +41,7 @@ Usage: rustup-init[EXE] [OPTIONS] Options: -v, --verbose - Enable verbose output + Enable verbose output, limit console logger level to 'DEBUG' if 'RUSTUP_LOG' is unset -q, --quiet Disable progress output, limit console logger level to 'WARN' if 'RUSTUP_LOG' is unset -y diff --git a/src/cli/setup_mode.rs b/src/cli/setup_mode.rs index fabcb2f901b..b8af3f325eb 100644 --- a/src/cli/setup_mode.rs +++ b/src/cli/setup_mode.rs @@ -25,12 +25,12 @@ use crate::{ before_help = format!("rustup-init {}", common::version()), )] struct RustupInit { - /// Enable verbose output - #[arg(short, long)] + /// Enable verbose output, limit console logger level to 'DEBUG' if 'RUSTUP_LOG' is unset + #[arg(short, long, overrides_with = "quiet")] verbose: bool, /// Disable progress output, limit console logger level to 'WARN' if 'RUSTUP_LOG' is unset - #[arg(short, long)] + #[arg(short, long, overrides_with = "verbose")] quiet: bool, /// Disable confirmation prompt @@ -115,10 +115,17 @@ pub async fn main( warn!("{}", common::WARN_COMPLETE_PROFILE); } - if quiet && process.var("RUSTUP_LOG").is_err() { - console_filter - .modify(|it| *it = EnvFilter::new("rustup=WARN")) - .expect("error reloading `EnvFilter` for console_logger"); + if process.var("RUSTUP_LOG").is_err() { + if quiet { + console_filter + .modify(|it| *it = EnvFilter::new("rustup=WARN")) + .expect("error reloading `EnvFilter` for console_logger"); + } + if verbose { + console_filter + .modify(|it| *it = EnvFilter::new("rustup=DEBUG")) + .expect("error reloading `EnvFilter` for console_logger"); + } } let opts = InstallOpts { 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 c51af98b68a..b2a32685274 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 @@ -10,7 +10,7 @@ Usage: rustup-init[EXE] [OPTIONS] Options: -v, --verbose - Enable verbose output + Enable verbose output, limit console logger level to 'DEBUG' if 'RUSTUP_LOG' is unset -q, --quiet Disable progress output, limit console logger level to 'WARN' if 'RUSTUP_LOG' is unset -y 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 1866e86f4e3..0e48e6e230f 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 @@ -10,7 +10,7 @@ Usage: rustup-init[EXE] [OPTIONS] Options: -v, --verbose - Enable verbose output + Enable verbose output, limit console logger level to 'DEBUG' if 'RUSTUP_LOG' is unset -q, --quiet Disable progress output, limit console logger level to 'WARN' if 'RUSTUP_LOG' is unset -y