diff --git a/interp/src/debugger/commands/core.rs b/interp/src/debugger/commands/core.rs index 6765ca8a23..0d40119743 100644 --- a/interp/src/debugger/commands/core.rs +++ b/interp/src/debugger/commands/core.rs @@ -380,7 +380,7 @@ lazy_static! { // print-state CIBuilder::new().invocation("print-state") .description("Print the internal state of the target cell. Takes an optional print code before the target") - .usage("> watch after GROUP with print-state \\s mem").build(), + .usage("> print-state \\s mem").build(), // watch CIBuilder::new().invocation("watch") .description("Watch a given group with a print statement. Takes an optional position (before/after)") diff --git a/interp/src/debugger/debugger_core.rs b/interp/src/debugger/debugger_core.rs index 3c06257966..230f67d136 100644 --- a/interp/src/debugger/debugger_core.rs +++ b/interp/src/debugger/debugger_core.rs @@ -207,15 +207,29 @@ impl + Clone> Debugger { "r".underline() ); + let mut err_count = 0_u8; + while !self.interpreter.is_done() { let comm = input_stream.next_command(); let comm = match comm { - Ok(c) => c, + Ok(c) => { + err_count = 0; + c + } Err(e) => match *e { InterpreterError::InvalidCommand(_) | InterpreterError::UnknownCommand(_) | InterpreterError::ParseError(_) => { println!("Error: {}", e.red().bold()); + err_count += 1; + if err_count == 3 { + println!( + "Type {} for a list of commands or {} for usage examples.", + "help".yellow().bold().underline(), + "explain".yellow().bold().underline() + ); + err_count = 0; + } continue; } _ => return Err(e), @@ -289,7 +303,7 @@ impl + Clone> Debugger { } Command::Explain => { - print!("{}", Command::get_explain_string().blue()) + print!("{}", Command::get_explain_string()) } Command::Restart => { @@ -342,7 +356,7 @@ impl + Clone> Debugger { return Ok(DebuggerReturnStatus::Exit); } Command::Explain => { - print!("{}", Command::get_explain_string().blue().bold()) + print!("{}", Command::get_explain_string()) } Command::Restart => { return Ok(DebuggerReturnStatus::Restart(Box::new(