use anyhow::{anyhow, Context, Result};
use std::fs::read_to_string;
use std::path::Path;
fn get_current_scheme(dir: &Path) -> Result<String> {
let file_path = &dir.join("lastscheme");
let scheme = read_to_string(file_path)
.with_context(|| "Failed to read last scheme file. Try applying first.")?
.split_whitespace()
.collect();
if scheme == "" {
Err(anyhow!(
"Failed to read last scheme from file. Try applying first."
))
} else {
Ok(scheme)
}
}
pub fn current(base_dir: &Path, _verbose: bool) -> Result<()> {
println!("{}", get_current_scheme(base_dir)?);
Ok(())
}