aboutsummaryrefslogtreecommitdiffstats
path: root/default-plugins/sequence/src/state/command_status.rs
blob: 39717e8bb4cc1e3c39f824c53034a6fc7f3d31cf (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
use zellij_tile::prelude::*;

#[derive(Debug, Clone)]
pub enum CommandStatus {
    Exited(Option<i32>, Option<PaneId>),
    Running(Option<PaneId>),
    Pending,
    Interrupted(Option<PaneId>),
}

impl CommandStatus {
    pub fn get_pane_id(&self) -> Option<PaneId> {
        match self {
            CommandStatus::Exited(_, pane_id) => *pane_id,
            CommandStatus::Running(pane_id) => *pane_id,
            CommandStatus::Pending => None,
            CommandStatus::Interrupted(pane_id) => *pane_id,
        }
    }
}

impl Default for CommandStatus {
    fn default() -> Self {
        CommandStatus::Pending
    }
}