diff --git a/crates/repl_cli/src/lib.rs b/crates/repl_cli/src/lib.rs index 93189e56505..32733414cff 100644 --- a/crates/repl_cli/src/lib.rs +++ b/crates/repl_cli/src/lib.rs @@ -75,10 +75,25 @@ pub fn main(has_color: bool, has_header: bool) -> i32 { loop { match editor.readline(&strip_colors_if_necessary(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")