use serde::{Deserialize, Serialize};
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
pub struct State {
pub current_environment: Option<String>,
pub project_root: Option<String>,
}
impl State {
pub fn new() -> Self {
Self::default()
}
pub fn set_current_environment(&mut self, env_name: String) {
self.current_environment = Some(env_name);
}
pub fn clear_current_environment(&mut self) {
self.current_environment = None;
}
pub fn get_current_environment(&self) -> Option<&str> {
self.current_environment.as_deref()
}
pub fn set_project_root(&mut self, path: String) {
self.project_root = Some(path);
}
pub fn get_project_root(&self) -> Option<&str> {
self.project_root.as_deref()
}
}