diff options
Diffstat (limited to 'src/config/mod.rs')
| -rw-r--r-- | src/config/mod.rs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/config/mod.rs b/src/config/mod.rs index 08509be..1b3d802 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -283,6 +283,24 @@ impl Config { Ok(()) } + pub fn get_state(&self) -> State { + if let Some(session) = &self.session { + if session.is_empty() { + if session.role.is_some() { + State::EmptySessionWithRole + } else { + State::EmptySession + } + } else { + State::Session + } + } else if self.role.is_some() { + State::Role + } else { + State::Normal + } + } + pub fn get_temperature(&self) -> Option<f64> { self.temperature } @@ -806,6 +824,15 @@ impl Keybindings { } } +#[derive(Debug, Clone, Copy, PartialEq, PartialOrd)] +pub enum State { + Normal, + Role, + EmptySession, + EmptySessionWithRole, + Session, +} + fn create_config_file(config_path: &Path) -> Result<()> { let ans = Confirm::new("No config file, create a new one?") .with_default(true) |
