Kill duplicate code

This commit is contained in:
greg 2019-06-05 02:54:13 -07:00
parent 376fa1d1d1
commit 32d082e119
2 changed files with 2 additions and 7 deletions

View File

@ -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;

View File

@ -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();