Kill duplicate code
This commit is contained in:
parent
376fa1d1d1
commit
32d082e119
@ -1,5 +1,4 @@
|
||||
use super::{Repl, InterpreterDirectiveOutput};
|
||||
use crate::repl::command_tree::CommandTree;
|
||||
use crate::repl::help::help;
|
||||
use crate::language::{LangMetaRequest, LangMetaResponse, DebugAsk, DebugResponse};
|
||||
use itertools::Itertools;
|
||||
|
@ -11,7 +11,7 @@ pub fn help(repl: &mut Repl, arguments: &[&str]) -> InterpreterDirectiveOutput {
|
||||
};
|
||||
|
||||
match arguments {
|
||||
[] => return global_help(repl),
|
||||
[] => return global_help(repl, &directives),
|
||||
_ => {
|
||||
writeln!(buf, "Command-specific help not available yet").unwrap();
|
||||
}
|
||||
@ -19,12 +19,8 @@ pub fn help(repl: &mut Repl, arguments: &[&str]) -> InterpreterDirectiveOutput {
|
||||
Some(buf)
|
||||
}
|
||||
|
||||
fn global_help(repl: &mut Repl) -> InterpreterDirectiveOutput {
|
||||
fn global_help(repl: &mut Repl, directives: &Vec<CommandTree>) -> InterpreterDirectiveOutput {
|
||||
let mut buf = String::new();
|
||||
let directives = match repl.get_directives() {
|
||||
CommandTree::Top(children) => children,
|
||||
_ => panic!("Top-level CommandTree not Top")
|
||||
};
|
||||
|
||||
writeln!(buf, "MetaInterpreter options").unwrap();
|
||||
writeln!(buf, "-----------------------").unwrap();
|
||||
|
Loading…
Reference in New Issue
Block a user