Help message
This commit is contained in:
parent
712da62d35
commit
d06cf90fce
@ -138,6 +138,31 @@ impl Repl {
|
||||
}
|
||||
}
|
||||
|
||||
fn print_help_message(&mut self) -> String {
|
||||
let mut buf = String::new();
|
||||
let directives = match self.get_directives() {
|
||||
CommandTree::Top(children) => children,
|
||||
_ => panic!("Top-level CommandTree not Top")
|
||||
};
|
||||
|
||||
writeln!(buf, "MetaInterpreter options").unwrap();
|
||||
writeln!(buf, "-----------------------").unwrap();
|
||||
|
||||
for directive in directives {
|
||||
let trailer = " ";
|
||||
writeln!(buf, "{}{}- {}", directive.get_cmd(), trailer, directive.get_help()).unwrap();
|
||||
}
|
||||
|
||||
let ref lang = self.get_cur_language_state();
|
||||
writeln!(buf, "").unwrap();
|
||||
writeln!(buf, "Language-specific help for {}", lang.get_language_name()).unwrap();
|
||||
writeln!(buf, "-----------------------").unwrap();
|
||||
//writeln!(buf, "{}", lang.custom_interpreter_directives_help()).unwrap();
|
||||
//writeln!(buf, "{}", "<not implemented>").unwrap();
|
||||
buf
|
||||
}
|
||||
|
||||
|
||||
fn get_cur_language_state(&mut self) -> &mut Box<ProgrammingLanguageInterface> {
|
||||
//TODO this is obviously not complete
|
||||
&mut self.language_states[0]
|
||||
@ -191,7 +216,9 @@ impl Repl {
|
||||
repl.save_before_exit();
|
||||
::std::process::exit(0)
|
||||
})),
|
||||
CommandTree::term("help", Some("Print this help message")),
|
||||
CommandTree::term_with_function("help", Some("Print this help message"), Box::new(|repl: &mut Repl, _cmds: Vec<&str>| {
|
||||
Some(repl.print_help_message())
|
||||
})),
|
||||
CommandTree::nonterm("debug",
|
||||
Some("show or hide pass debug info for a given pass, or display the names of all passes, or turn timing on/off"),
|
||||
vec![
|
||||
|
Loading…
Reference in New Issue
Block a user