use crate::poem::Verse; use std::env; pub fn incant(verse: &Verse) -> i32 { let path = match verse.clause() { Some(path) => path[0].to_string(), None => match env::var("HOME") { Ok(val) => val, Err(_) => { eprintln!("cd: unknown home, staying in pwd"); return 1; } }, }; match std::env::set_current_dir(&path) { Ok(_) => 0, Err(e) => { eprintln!( "cd: unable to change into {}: {}", path, e.to_string().to_lowercase() ); 1 } } }