fn edit(message: EditMessage, state: &SharedState) -> Message {
    // Check whether the task exists and is locked. Abort if that's not the case
    let mut state = state.lock().unwrap();
    match state.tasks.get_mut(&message.task_id) {
        Some(task) => {
            if !(task.status == TaskStatus::Locked) {
                return create_failure_message("Task is no longer locked.");
            }

            task.status = task.prev_status.clone();
            task.command = message.command.clone();
            task.path = message.path.clone();
            state.save();

            create_success_message("Command has been updated")
        }
        None => create_failure_message(format!("Task to edit has gone away: {}", message.task_id)),
    }
}
/// Invoked after closing the editor on `pueue edit`.
/// Now we actually update the message with the updated command from the client.
Invoked after closing the editor on `pueue edit`.
Now we actually update the message with the updated command from the client.
Invoked after closing the editor on ` pueue edit ` . Now we actually update the message with the updated command from the client .
fn edit(message: EditMessage, state: &SharedState) -> Message {
    // Check whether the task exists and is locked. Abort if that's not the case
    let mut state = state.lock().unwrap();
    match state.tasks.get_mut(&message.task_id) {
        Some(task) => {
            if !(task.status == TaskStatus::Locked) {
                return create_failure_message("Task is no longer locked.");
            }
            task.status = task.prev_status.clone();
            task.command = message.command.clone();
            task.path = message.path.clone();
            state.save();
            create_success_message("Command has been updated")
        }
        None => create_failure_message(format!("Task to edit has gone away: {}", message.task_id)),
    }
}
fn edit ( message : EditMessage , state : & SharedState ) -> Message { // Check whether the task exists and is locked. Abort if that's not the case let mut state = state . lock ( ) . unwrap ( ) ; match state . tasks . get_mut ( & message . task_id ) { Some ( task ) => { if ! ( task . status == TaskStatus :: Locked ) { return create_failure_message ( " " ) ; } task . status = task . prev_status . clone ( ) ; task . command = message . command . clone ( ) ; task . path = message . path . clone ( ) ; state . save ( ) ; create_success_message ( " " ) } None => create_failure_message ( format ! ( " " message task_id ) ) , } }
Invoked after closing the editor on `pueue edit`.
Invoked after closing the editor on ` pueue edit ` .
message
EditMessage
state
&SharedState