summaryrefslogtreecommitdiff
path: root/cli
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2022-12-09 10:54:24 -0500
committerGitHub <noreply@github.com>2022-12-09 10:54:24 -0500
commit653aebfa1aa9121070df98ee88474b5f821fb15d (patch)
tree90766bc70aa83f4f16ec1c517e495cd7c6a98fbd /cli
parentcb6700fa5aac03fb3e082f9ed2e01d74238e6a99 (diff)
fix: respect the `--quiet` flag in more cases (#16998)
Diffstat (limited to 'cli')
-rw-r--r--cli/args/flags.rs6
-rw-r--r--cli/graph_util.rs2
-rw-r--r--cli/http_util.rs2
-rw-r--r--cli/tests/compile_tests.rs1
-rw-r--r--cli/tests/info_tests.rs1
-rw-r--r--cli/tools/bundle.rs2
-rw-r--r--cli/tools/fmt.rs5
-rw-r--r--cli/tools/installer.rs22
-rw-r--r--cli/tools/standalone.rs6
-rw-r--r--cli/tools/vendor/mod.rs6
-rw-r--r--cli/tsc/mod.rs3
11 files changed, 27 insertions, 29 deletions
diff --git a/cli/args/flags.rs b/cli/args/flags.rs
index f4bc0c862..c60bc0d99 100644
--- a/cli/args/flags.rs
+++ b/cli/args/flags.rs
@@ -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."),
);
diff --git a/cli/graph_util.rs b/cli/graph_util.rs
index 253d556e0..2c44e39c2 100644
--- a/cli/graph_util.rs
+++ b/cli/graph_util.rs
@@ -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());
diff --git a/cli/http_util.rs b/cli/http_util.rs
index 5cb843a42..827cc75f5 100644
--- a/cli/http_util.rs
+++ b/cli/http_util.rs
@@ -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()
diff --git a/cli/tests/compile_tests.rs b/cli/tests/compile_tests.rs
index 970ef5ee3..30d882c3b 100644
--- a/cli/tests/compile_tests.rs
+++ b/cli/tests/compile_tests.rs
@@ -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();
diff --git a/cli/tests/info_tests.rs b/cli/tests/info_tests.rs
index 5818fe3be..a255eab4f 100644
--- a/cli/tests/info_tests.rs
+++ b/cli/tests/info_tests.rs
@@ -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"");
diff --git a/cli/tools/bundle.rs b/cli/tools/bundle.rs
index 606bab46f..95aa52b5b 100644
--- a/cli/tools/bundle.rs
+++ b/cli/tools/bundle.rs
@@ -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);
}
}
diff --git a/cli/tools/fmt.rs b/cli/tools/fmt.rs
index 7b5797d88..fee59c6dc 100644
--- a/cli/tools/fmt.rs
+++ b/cli/tools/fmt.rs
@@ -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(())
diff --git a/cli/tools/installer.rs b/cli/tools/installer.rs
index fd7f68b71..cef4befc8 100644
--- a/cli/tools/installer.rs
+++ b/cli/tools/installer.rs
@@ -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 {
diff --git a/cli/tools/standalone.rs b/cli/tools/standalone.rs
index f7a258a73..c276119ea 100644
--- a/cli/tools/standalone.rs
+++ b/cli/tools/standalone.rs
@@ -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)
};
diff --git a/cli/tools/vendor/mod.rs b/cli/tools/vendor/mod.rs
index ed0c69501..02261e34c 100644
--- a/cli/tools/vendor/mod.rs
+++ b/cli/tools/vendor/mod.rs
@@ -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>"` "#,
diff --git a/cli/tsc/mod.rs b/cli/tsc/mod.rs
index 18d72e413..a587de376 100644
--- a/cli/tsc/mod.rs
+++ b/cli/tsc/mod.rs
@@ -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());
}
}