This commit is contained in:
greg 2018-05-01 18:10:24 -07:00
parent 061d54702f
commit fe64cbcd3a
1 changed files with 8 additions and 11 deletions

View File

@ -298,19 +298,16 @@ impl Repl {
Some(s) => s.to_string(),
None => return Some(format!("Must specify a stage to debug")),
};
let maybe_debug = stages.iter().find(|stage_name| **stage_name == debug_stage);
match (show, maybe_debug) {
(true, Some(s)) => {
let msg = format!("Enabling debug for stage {}", debug_stage);
if let Some(stage) = stages.iter().find(|stage_name| **stage_name == debug_stage) {
let msg = format!("{} debug for stage {}", if show { "Enabling" } else { "Disabling" }, debug_stage);
if show {
self.options.debug_stages.insert(debug_stage);
Some(msg)
},
(false, Some(s)) => {
let msg = format!("Disabling debug for stage {}", debug_stage);
} else {
self.options.debug_stages.remove(&debug_stage);
Some(msg)
},
(_, None) => Some(format!("couldn't find it"))
}
Some(msg)
} else {
Some(format!("Couldn't find stage: {}", debug_stage))
}
},
_ => Some(format!("Unknown debug command"))