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,
QuitProgram,
ListPasses,
TotalTimeOff,
TotalTimeOn,
StageTimeOff,
StageTimeOn,
TotalTime(bool),
StageTime(bool),
Doc,
}
@ -50,20 +48,12 @@ impl DirectiveAction {
}
Some(buf)
}
TotalTimeOff => {
repl.options.show_total_time = false;
TotalTime(value) => {
repl.options.show_total_time = *value;
None
}
TotalTimeOn => {
repl.options.show_total_time = true;
None
}
StageTimeOff => {
repl.options.show_stage_times = false;
None
}
StageTimeOn => {
repl.options.show_stage_times = true;
StageTime(value) => {
repl.options.show_stage_times = *value;
None
}
Doc => doc(repl, arguments),

View File

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