diff options
Diffstat (limited to 'cli/tools/repl/mod.rs')
-rw-r--r-- | cli/tools/repl/mod.rs | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/cli/tools/repl/mod.rs b/cli/tools/repl/mod.rs index afbd39eff..502105139 100644 --- a/cli/tools/repl/mod.rs +++ b/cli/tools/repl/mod.rs @@ -1,5 +1,7 @@ // Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. +use crate::args::ReplFlags; +use crate::colors; use crate::proc_state::ProcState; use deno_core::error::AnyError; use deno_runtime::permissions::Permissions; @@ -77,8 +79,7 @@ async fn read_eval_file( pub async fn run( ps: &ProcState, worker: MainWorker, - maybe_eval_files: Option<Vec<String>>, - maybe_eval: Option<String>, + repl_flags: ReplFlags, ) -> Result<i32, AnyError> { let mut repl_session = ReplSession::initialize(worker).await?; let mut rustyline_channel = rustyline_channel(); @@ -92,7 +93,7 @@ pub async fn run( let history_file_path = ps.dir.repl_history_file_path(); let editor = ReplEditor::new(helper, history_file_path)?; - if let Some(eval_files) = maybe_eval_files { + if let Some(eval_files) = repl_flags.eval_files { for eval_file in eval_files { match read_eval_file(ps, &eval_file).await { Ok(eval_source) => { @@ -114,7 +115,7 @@ pub async fn run( } } - if let Some(eval) = maybe_eval { + if let Some(eval) = repl_flags.eval { let output = repl_session.evaluate_line_and_get_output(&eval).await?; // only output errors if let EvaluationOutput::Error(error_text) = output { @@ -127,6 +128,13 @@ pub async fn run( if !ps.options.is_quiet() { println!("Deno {}", crate::version::deno()); println!("exit using ctrl+d, ctrl+c, or close()"); + if repl_flags.is_default_command { + println!( + "{}", + colors::yellow("REPL is running with all permissions allowed.") + ); + println!("To specify permissions, run `deno repl` with allow flags.") + } } loop { |