Add :doc interpreter directive
This commit is contained in:
parent
1abbe2e448
commit
92078ef7d8
@ -156,6 +156,9 @@ pub trait ProgrammingLanguageInterface {
|
|||||||
fn custom_interpreter_directives_help(&self) -> String {
|
fn custom_interpreter_directives_help(&self) -> String {
|
||||||
format!(">> No custom interpreter directives specified <<")
|
format!(">> No custom interpreter directives specified <<")
|
||||||
}
|
}
|
||||||
|
fn get_doc(&mut self, _commands: &Vec<&str>) -> Option<String> {
|
||||||
|
None
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* a pass_chain function signature looks like:
|
/* a pass_chain function signature looks like:
|
||||||
|
@ -361,6 +361,7 @@ impl Repl {
|
|||||||
CommandTree::term("prev", None),
|
CommandTree::term("prev", None),
|
||||||
CommandTree::NonTerminal(format!("go"), vec![], None)//TODO
|
CommandTree::NonTerminal(format!("go"), vec![], None)//TODO
|
||||||
], Some(format!("switch between languages, or go directly to a langauge by name"))),
|
], Some(format!("switch between languages, or go directly to a langauge by name"))),
|
||||||
|
CommandTree::term("doc", Some("Get language-specific help for an item")),
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -437,6 +438,9 @@ impl Repl {
|
|||||||
Some(buf)
|
Some(buf)
|
||||||
},
|
},
|
||||||
"debug" => self.handle_debug(commands),
|
"debug" => self.handle_debug(commands),
|
||||||
|
"doc" => self.languages[self.current_language_index]
|
||||||
|
.get_doc(&commands)
|
||||||
|
.or(Some(format!("No docs implemented"))),
|
||||||
e => self.languages[self.current_language_index]
|
e => self.languages[self.current_language_index]
|
||||||
.handle_custom_interpreter_directives(&commands)
|
.handle_custom_interpreter_directives(&commands)
|
||||||
.or(Some(format!("Unknown command: {}", e)))
|
.or(Some(format!("Unknown command: {}", e)))
|
||||||
|
Loading…
Reference in New Issue
Block a user