From 74f408938790c3a2d30b11d593c2b0d74bb98879 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 12 Mar 2018 23:08:49 +0300 Subject: [PATCH] Fix spelling of quiet --- src/bin/cli.rs | 9 +++++---- tests/testsuite/run.rs | 10 +++++++--- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/bin/cli.rs b/src/bin/cli.rs index 659790f1c..b9653661e 100644 --- a/src/bin/cli.rs +++ b/src/bin/cli.rs @@ -10,7 +10,7 @@ use clap::{AppSettings, Arg, ArgMatches}; use toml; use cargo::{self, Config, CargoError, CliResult, CliError}; -use cargo::core::{Source, SourceId, GitReference, Package}; +use cargo::core::{Source, SourceId, GitReference, Package, Verbosity}; use cargo::ops::{self, CompileMode, OutputMetadataOptions}; use cargo::sources::{GitSource, RegistrySource}; use cargo::util::{ToUrl, CargoResultExt}; @@ -73,7 +73,7 @@ pub fn main(config: &mut Config) -> CliResult { fn execute_subcommand(config: &mut Config, args: ArgMatches) -> CliResult { config.configure( args.occurrences_of("verbose") as u32, - if args.is_present("quite") { Some(true) } else { None }, + if args.is_present("quiet") { Some(true) } else { None }, &args.value_of("color").map(|s| s.to_string()), args.is_present("frozen"), args.is_present("locked"), @@ -391,7 +391,8 @@ fn execute_subcommand(config: &mut Config, args: ArgMatches) -> CliResult { // a failed process, we assume the process itself printed out enough // information about why it failed so we don't do so as well let exit_code = exit.code().unwrap_or(101); - Err(if args.is_present("quite") { + let is_quiet = config.shell().verbosity() == Verbosity::Quiet; + Err(if is_quiet { CliError::code(exit_code) } else { CliError::new(err.into(), exit_code) @@ -612,7 +613,7 @@ See 'cargo help ' for more information on a specific command." .short("v").multiple(true).global(true) ) .arg( - opt("quite", "No output printed to stdout") + opt("quiet", "No output printed to stdout") .short("q").global(true) ) .arg( diff --git a/tests/testsuite/run.rs b/tests/testsuite/run.rs index 22678ca23..b3d38f256 100644 --- a/tests/testsuite/run.rs +++ b/tests/testsuite/run.rs @@ -43,9 +43,13 @@ fn simple_quiet() { .build(); assert_that(p.cargo("run").arg("-q"), - execs().with_status(0).with_stdout("\ -hello -") + execs().with_status(0) + .with_stdout("hello") + ); + + assert_that(p.cargo("run").arg("--quiet"), + execs().with_status(0) + .with_stdout("hello") ); } -- 2.30.2