diff --git a/pueue/src/client/client.rs b/pueue/src/client/client.rs index abd8730..d20bce3 100644 --- a/pueue/src/client/client.rs +++ b/pueue/src/client/client.rs @@ -173,13 +173,23 @@ impl Client { async fn handle_complex_command(&mut self) -> Result { // This match handles all "complex" commands. match &self.subcommand { - SubCommand::Reset { force, .. } => { + SubCommand::Reset { force, groups } => { // Get the current state and check if there're any running tasks. // If there are, ask the user if they really want to reset the state. let state = get_state(&mut self.stream).await?; + + // Get the groups that should be reset. + let groups: Vec = if groups.is_empty() { + state.groups.keys().cloned().collect() + } else { + groups.clone() + }; + + // Check if there're any running tasks for that group let running_tasks = state .tasks .iter() + .filter(|(_id, task)| groups.contains(&task.group)) .filter_map(|(id, task)| if task.is_running() { Some(*id) } else { None }) .collect::>();