diff --git a/crates/repl_cli/src/lib.rs b/crates/repl_cli/src/lib.rs index 08ee592498e..fca3ac215f8 100644 --- a/crates/repl_cli/src/lib.rs +++ b/crates/repl_cli/src/lib.rs @@ -52,10 +52,25 @@ pub fn main() -> i32 { loop { match editor.readline(PROMPT) { Ok(line) => { - let line = line.trim(); + let line = line.trim_end(); + if line.trim().is_empty() { + // empty lines are ignored + println!(); + continue; + } editor.add_history_entry(line); + if line + .lines() + .map(|ln| ln.trim()) + .all(|ln| ln.is_empty() || ln.starts_with("#")) + { + // if there are only whitespaces and comments, don't run it + println!(); + continue; + } + let repl_state = &mut editor .helper_mut() .expect("Editor helper was not set")