Simplify directive types

This commit is contained in:
Greg Shuflin 2021-10-14 02:20:11 -07:00
parent 6ac0628265
commit 2d72f560ed
2 changed files with 10 additions and 20 deletions

View File

@ -11,10 +11,8 @@ pub enum DirectiveAction {
Help, Help,
QuitProgram, QuitProgram,
ListPasses, ListPasses,
TotalTimeOff, TotalTime(bool),
TotalTimeOn, StageTime(bool),
StageTimeOff,
StageTimeOn,
Doc, Doc,
} }
@ -50,20 +48,12 @@ impl DirectiveAction {
} }
Some(buf) Some(buf)
} }
TotalTimeOff => { TotalTime(value) => {
repl.options.show_total_time = false; repl.options.show_total_time = *value;
None None
} }
TotalTimeOn => { StageTime(value) => {
repl.options.show_total_time = true; repl.options.show_stage_times = *value;
None
}
StageTimeOff => {
repl.options.show_stage_times = false;
None
}
StageTimeOn => {
repl.options.show_stage_times = true;
None None
} }
Doc => doc(repl, arguments), Doc => doc(repl, arguments),

View File

@ -54,16 +54,16 @@ fn get_list(passes_directives: &[CommandTree], include_help: bool) -> Vec<Comman
"total-time", "total-time",
None, None,
vec![ vec![
CommandTree::terminal("on", None, vec![], TotalTimeOn), CommandTree::terminal("on", None, vec![], TotalTime(true)),
CommandTree::terminal("off", None, vec![], TotalTimeOff), CommandTree::terminal("off", None, vec![], TotalTime(false)),
], ],
), ),
CommandTree::nonterm( CommandTree::nonterm(
"stage-times", "stage-times",
Some("Computation time per-stage"), Some("Computation time per-stage"),
vec![ vec![
CommandTree::terminal("on", None, vec![], StageTimeOn), CommandTree::terminal("on", None, vec![], StageTime(true)),
CommandTree::terminal("off", None, vec![], StageTimeOff), CommandTree::terminal("off", None, vec![], StageTime(false)),
], ],
), ),
], ],