diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2022-11-30 23:25:20 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-30 23:25:20 +0100 |
commit | d1962e07afb3761c85cde90bda751c23c144741f (patch) | |
tree | c65d5adfe28427d06a51de1d9c3c13923ee2b95c /cli/tools/repl/mod.rs | |
parent | 381932ce1e79f38bbf8bdf28b4e808038aead7a7 (diff) |
fix(repl): respect --quiet flag (#16875)
This commit changes REPL behavior to respect --quiet flag. Once
this flag is present REPL will not print a banner at the start.
Diffstat (limited to 'cli/tools/repl/mod.rs')
-rw-r--r-- | cli/tools/repl/mod.rs | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/cli/tools/repl/mod.rs b/cli/tools/repl/mod.rs index 1cdb17ab1..afbd39eff 100644 --- a/cli/tools/repl/mod.rs +++ b/cli/tools/repl/mod.rs @@ -101,11 +101,14 @@ pub async fn run( .await?; // only output errors if let EvaluationOutput::Error(error_text) = output { - println!("error in --eval-file file {}. {}", eval_file, error_text); + println!( + "Error in --eval-file file \"{}\": {}", + eval_file, error_text + ); } } Err(e) => { - println!("error in --eval-file file {}. {}", eval_file, e); + println!("Error in --eval-file file \"{}\": {}", eval_file, e); } } } @@ -115,12 +118,16 @@ pub async fn run( let output = repl_session.evaluate_line_and_get_output(&eval).await?; // only output errors if let EvaluationOutput::Error(error_text) = output { - println!("error in --eval flag. {}", error_text); + println!("Error in --eval flag: {}", error_text); } } - println!("Deno {}", crate::version::deno()); - println!("exit using ctrl+d, ctrl+c, or close()"); + // Doing this manually, instead of using `log::info!` because these messages + // are supposed to go to stdout, not stderr. + if !ps.options.is_quiet() { + println!("Deno {}", crate::version::deno()); + println!("exit using ctrl+d, ctrl+c, or close()"); + } loop { let line = read_line_and_poll( |