1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-23 15:49:44 -05:00

fix: respect the --quiet flag in more cases (#16998)

This commit is contained in:
David Sherret 2022-12-09 10:54:24 -05:00 committed by GitHub
parent cb6700fa5a
commit 653aebfa1a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 27 additions and 29 deletions

View file

@ -2805,7 +2805,11 @@ fn test_parse(flags: &mut Flags, matches: &clap::ArgMatches) {
.unwrap_or(NonZeroUsize::new(1).unwrap())
}
} else if matches.is_present("jobs") {
println!(
// We can't change this to use the log crate because its not configured
// yet at this point since the flags haven't been parsed. This flag is
// deprecated though so it's not worth changing the code to use the log
// crate here and this is only done for testing anyway.
eprintln!(
"{}",
crate::colors::yellow("Warning: --jobs flag is deprecated. Use the --parallel flag with possibly the 'DENO_JOBS' environment variable."),
);

View file

@ -563,7 +563,7 @@ pub async fn create_graph_and_maybe_check(
lib: ps.options.ts_type_lib_window(),
})?;
if let Some(ignored_options) = ts_config_result.maybe_ignored_options {
eprintln!("{}", ignored_options);
log::warn!("{}", ignored_options);
}
let maybe_config_specifier = ps.options.maybe_config_file_specifier();
let cache = TypeCheckCache::new(&ps.dir.type_checking_cache_db_file_path());

View file

@ -276,7 +276,7 @@ impl HttpClient {
let response_headers = response.headers();
if let Some(warning) = response_headers.get("X-Deno-Warning") {
eprintln!(
log::warn!(
"{} {}",
crate::colors::yellow("Warning"),
warning.to_str().unwrap()

View file

@ -153,7 +153,6 @@ mod compile {
.wait_with_output()
.unwrap();
assert!(!output.status.success());
println!("{:#?}", &output);
assert_eq!(output.stdout, b"hello\n");
let stderr = String::from_utf8(output.stderr).unwrap();
let stderr = util::strip_ansi_codes(&stderr).to_string();

View file

@ -34,7 +34,6 @@ mod init {
.unwrap();
let str_output = std::str::from_utf8(&output.stdout).unwrap().trim();
eprintln!("{}", str_output);
// check the output of the test.ts program.
assert!(str_output.contains("emit: "));
assert_eq!(output.stderr, b"");

View file

@ -143,7 +143,7 @@ fn bundle_module_graph(
.resolve_ts_config_for_emit(TsConfigType::Bundle)?;
if ps.options.type_check_mode() == TypeCheckMode::None {
if let Some(ignored_options) = ts_config_result.maybe_ignored_options {
eprintln!("{}", ignored_options);
log::warn!("{}", ignored_options);
}
}

View file

@ -28,6 +28,7 @@ use deno_core::futures;
use deno_core::parking_lot::Mutex;
use log::debug;
use log::info;
use log::warn;
use std::fs;
use std::io::stdin;
use std::io::stdout;
@ -325,8 +326,8 @@ async fn check_source_files(
Err(e) => {
not_formatted_files_count.fetch_add(1, Ordering::Relaxed);
let _g = output_lock.lock();
eprintln!("Error checking: {}", file_path.to_string_lossy());
eprintln!(" {}", e);
warn!("Error checking: {}", file_path.to_string_lossy());
warn!(" {}", e);
}
}
Ok(())

View file

@ -186,7 +186,7 @@ pub fn uninstall(name: String, root: Option<PathBuf>) -> Result<(), AnyError> {
if file_path.exists() {
fs::remove_file(&file_path)?;
println!("deleted {}", file_path.to_string_lossy());
log::info!("deleted {}", file_path.to_string_lossy());
removed = true
};
@ -194,7 +194,7 @@ pub fn uninstall(name: String, root: Option<PathBuf>) -> Result<(), AnyError> {
let file_path = file_path.with_extension("cmd");
if file_path.exists() {
fs::remove_file(&file_path)?;
println!("deleted {}", file_path.to_string_lossy());
log::info!("deleted {}", file_path.to_string_lossy());
removed = true
}
}
@ -208,11 +208,11 @@ pub fn uninstall(name: String, root: Option<PathBuf>) -> Result<(), AnyError> {
let file_path = file_path.with_extension(ext);
if file_path.exists() {
fs::remove_file(&file_path)?;
println!("deleted {}", file_path.to_string_lossy());
log::info!("deleted {}", file_path.to_string_lossy());
}
}
println!("✅ Successfully uninstalled {}", name);
log::info!("✅ Successfully uninstalled {}", name);
Ok(())
}
@ -256,20 +256,20 @@ fn create_install_shim(
fs::write(path, contents)?;
}
println!("✅ Successfully installed {}", shim_data.name);
println!("{}", shim_data.file_path.display());
log::info!("✅ Successfully installed {}", shim_data.name);
log::info!("{}", shim_data.file_path.display());
if cfg!(windows) {
let display_path = shim_data.file_path.with_extension("");
println!("{} (shell)", display_path.display());
log::info!("{} (shell)", display_path.display());
}
let installation_dir_str = shim_data.installation_dir.to_string_lossy();
if !is_in_path(&shim_data.installation_dir) {
println!(" Add {} to PATH", installation_dir_str);
log::info!(" Add {} to PATH", installation_dir_str);
if cfg!(windows) {
println!(" set PATH=%PATH%;{}", installation_dir_str);
log::info!(" set PATH=%PATH%;{}", installation_dir_str);
} else {
println!(" export PATH=\"{}:$PATH\"", installation_dir_str);
log::info!(" export PATH=\"{}:$PATH\"", installation_dir_str);
}
}
@ -605,7 +605,6 @@ mod tests {
assert!(file_path.exists());
let content = fs::read_to_string(file_path).unwrap();
println!("this is the file path {:?}", content);
if cfg!(windows) {
assert!(content.contains(
r#""run" "--unstable" "http://localhost:4545/echo_server.ts""#
@ -970,7 +969,6 @@ mod tests {
assert!(file_path.exists());
let content = fs::read_to_string(file_path).unwrap();
println!("{}", content);
if cfg!(windows) {
// TODO: see comment above this test
} else {

View file

@ -122,15 +122,15 @@ async fn download_base_binary(
let client_builder = Client::builder();
let client = client_builder.build()?;
println!("Checking {}", &download_url);
log::info!("Checking {}", &download_url);
let res = client.get(&download_url).send().await?;
let binary_content = if res.status().is_success() {
println!("Download has been found");
log::info!("Download has been found");
res.bytes().await?.to_vec()
} else {
println!("Download could not be found, aborting");
log::info!("Download could not be found, aborting");
std::process::exit(1)
};

View file

@ -53,7 +53,7 @@ pub async fn vendor(
&build::RealVendorEnvironment,
)?;
eprintln!(
log::info!(
concat!("Vendored {} {} into {} directory.",),
vendored_count,
if vendored_count == 1 {
@ -66,7 +66,7 @@ pub async fn vendor(
if vendored_count > 0 {
let import_map_path = raw_output_dir.join("import_map.json");
if maybe_update_config_file(&output_dir, &ps) {
eprintln!(
log::info!(
concat!(
"\nUpdated your local Deno configuration file with a reference to the ",
"new vendored import map at {}. Invoking Deno subcommands will now ",
@ -77,7 +77,7 @@ pub async fn vendor(
import_map_path.display(),
);
} else {
eprintln!(
log::info!(
concat!(
"\nTo use vendored modules, specify the `--import-map {}` flag when ",
r#"invoking Deno subcommands or add an `"importMap": "<path_to_vendored_import_map>"` "#,

View file

@ -1222,7 +1222,6 @@ mod tests {
let actual = test_exec(&specifier)
.await
.expect("exec should not have errored");
eprintln!("diagnostics {:#?}", actual.diagnostics);
assert!(actual.diagnostics.is_empty());
assert!(actual.maybe_tsbuildinfo.is_some());
assert_eq!(actual.stats.0.len(), 12);
@ -1234,7 +1233,6 @@ mod tests {
let actual = test_exec(&specifier)
.await
.expect("exec should not have errored");
eprintln!("diagnostics {:#?}", actual.diagnostics);
assert!(actual.diagnostics.is_empty());
assert!(actual.maybe_tsbuildinfo.is_some());
assert_eq!(actual.stats.0.len(), 12);
@ -1246,7 +1244,6 @@ mod tests {
let actual = test_exec(&specifier)
.await
.expect("exec should not have errored");
eprintln!("diagnostics {:#?}", actual.diagnostics);
assert!(actual.diagnostics.is_empty());
}
}