fn edit_request(task_id: usize, state: &SharedState) -> Message {
    // Check whether the task exists and is queued/stashed. Abort if that's not the case.
    let mut state = state.lock().unwrap();
    match state.tasks.get_mut(&task_id) {
        Some(task) => {
            if !task.is_queued() {
                return create_failure_message("You can only edit a queued/stashed task");
            }
            task.prev_status = task.status.clone();
            task.status = TaskStatus::Locked;

            let message = EditResponseMessage {
                task_id: task.id,
                command: task.command.clone(),
                path: task.path.clone(),
            };
            Message::EditResponse(message)
        }
        None => create_failure_message("No task with this id."),
    }
}
/// Invoked when calling `pueue edit`.
/// If a user wants to edit a message, we need to send him the current command.
/// Lock the task to prevent execution, before the user has finished editing the command.
Invoked when calling `pueue edit`.
If a user wants to edit a message, we need to send him the current command.
Lock the task to prevent execution, before the user has finished editing the command.
Invoked when calling ` pueue edit ` . If a user wants to edit a message we need to send him the current command . Lock the task to prevent execution before the user has finished editing the command .
fn edit_request(task_id: usize, state: &SharedState) -> Message {
    // Check whether the task exists and is queued/stashed. Abort if that's not the case.
    let mut state = state.lock().unwrap();
    match state.tasks.get_mut(&task_id) {
        Some(task) => {
            if !task.is_queued() {
                return create_failure_message("You can only edit a queued/stashed task");
            }
            task.prev_status = task.status.clone();
            task.status = TaskStatus::Locked;
            let message = EditResponseMessage {
                task_id: task.id,
                command: task.command.clone(),
                path: task.path.clone(),
            };
            Message::EditResponse(message)
        }
        None => create_failure_message("No task with this id."),
    }
}
fn edit_request ( task_id : usize , state : & SharedState ) -> Message { // Check whether the task exists and is queued/stashed. Abort if that's not the case. let mut state = state . lock ( ) . unwrap ( ) ; match state . tasks . get_mut ( & task_id ) { Some ( task ) => { if ! task . is_queued ( ) { return create_failure_message ( " " ) ; } task . prev_status = task . status . clone ( ) ; task . status = TaskStatus :: Locked ; let message = EditResponseMessage { task_id : task . id , command : task . command . clone ( ) , path : task . path . clone ( ) , } ; Message :: EditResponse ( message ) } None => create_failure_message ( " " ) , } }
Invoked when calling `pueue edit`.
Invoked when calling ` pueue edit ` .
task_id
usize
state
&SharedState