use crate::state::persistence::load_state;
use crate::utils::colors::colorize_environment;
use anyhow::Result;
pub fn handle_current() -> Result<()> {
match load_state() {
Ok(state) => {
match state.get_current_environment() {
Some(env_name) => {
println!(
"Current environment: {}",
colorize_environment(env_name, Some("green"))
);
}
None => {
println!("No environment is currently active");
println!("Use 'stand shell <environment>' to activate an environment");
}
}
Ok(())
}
Err(e) => {
println!("❌ Failed to load state: {}", e);
anyhow::bail!("Failed to load state")
}
}
}
#[cfg(test)]
mod tests {
use crate::state::types::State;
#[test]
fn test_current_logic() {
}
#[test]
fn test_state_operations() {
let mut state = State::new();
assert_eq!(state.get_current_environment(), None);
state.set_current_environment("test".to_string());
assert_eq!(state.get_current_environment(), Some("test"));
state.clear_current_environment();
assert_eq!(state.get_current_environment(), None);
}
}