use crate::core::{parser, types};
use std::path::Path;
#[allow(unused_imports)]
pub(crate) use super::colors::{bold, color_enabled, dim, green, red, yellow, NO_COLOR};
pub(crate) fn parse_and_validate(file: &Path) -> Result<types::ForjarConfig, String> {
parser::parse_and_validate(file)
}
pub(crate) fn discover_machines(state_dir: &Path) -> Vec<String> {
let mut machines = Vec::new();
if let Ok(entries) = std::fs::read_dir(state_dir) {
for entry in entries.flatten() {
if entry.path().is_dir() {
let name = entry.file_name().to_string_lossy().to_string();
if entry.path().join("state.lock.yaml").exists() {
machines.push(name);
}
}
}
}
machines.sort();
machines
}