Move where help is computed
This commit is contained in:
parent
3a98096b61
commit
04253543e9
@ -141,13 +141,15 @@ impl Repl {
|
||||
}
|
||||
}
|
||||
|
||||
fn print_help_message(&mut self) -> String {
|
||||
fn print_help_message(&mut self, commands_passed_to_help: &[&str] ) -> String {
|
||||
let mut buf = String::new();
|
||||
let directives = match self.get_directives() {
|
||||
CommandTree::Top(children) => children,
|
||||
_ => panic!("Top-level CommandTree not Top")
|
||||
};
|
||||
|
||||
match commands_passed_to_help {
|
||||
[] => {
|
||||
writeln!(buf, "MetaInterpreter options").unwrap();
|
||||
writeln!(buf, "-----------------------").unwrap();
|
||||
|
||||
@ -160,12 +162,14 @@ impl Repl {
|
||||
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();
|
||||
},
|
||||
_ => {
|
||||
writeln!(buf, "Command-specific help not available yet").unwrap();
|
||||
}
|
||||
};
|
||||
buf
|
||||
}
|
||||
|
||||
|
||||
fn get_cur_language_state(&mut self) -> &mut Box<ProgrammingLanguageInterface> {
|
||||
//TODO this is obviously not complete
|
||||
&mut self.language_states[0]
|
||||
@ -209,10 +213,7 @@ impl Repl {
|
||||
::std::process::exit(0)
|
||||
})),
|
||||
CommandTree::term_with_function("help", Some("Print this help message"), Box::new(|repl: &mut Repl, cmds: &[&str]| {
|
||||
Some(match cmds {
|
||||
[] => repl.print_help_message(),
|
||||
_ => format!("ARGS: {:?}", cmds)
|
||||
})
|
||||
Some(repl.print_help_message(cmds))
|
||||
})),
|
||||
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"),
|
||||
|
Loading…
Reference in New Issue
Block a user