wisp/session/
workspace_status.rs1use std::path::Path;
2
3use acp_utils::notifications::WorkspaceStatusResponse;
4
5#[derive(Debug, Clone, Copy, Default, PartialEq, Eq)]
6pub enum WorkspaceAccess {
7 #[default]
8 Local,
9 Remote,
10}
11
12#[derive(Debug, Clone, PartialEq, Eq)]
13pub struct WorkspaceStatus {
14 pub display_dir: String,
15 pub git_ref: Option<String>,
16}
17
18impl WorkspaceStatus {
19 pub fn new(display_dir: impl Into<String>, git_ref: Option<String>) -> Self {
20 Self { display_dir: display_dir.into(), git_ref }
21 }
22
23 pub fn initial(cwd: &Path) -> Self {
24 Self::new(cwd.display().to_string(), None)
25 }
26}
27
28impl From<WorkspaceStatusResponse> for WorkspaceStatus {
29 fn from(response: WorkspaceStatusResponse) -> Self {
30 Self::new(response.display_dir, response.git_ref)
31 }
32}