pub fn parse_config_line<'a>(
raw_line: &'a str,
path_display: &'a str,
line_num: usize,
) -> Option<(&'a str, &'a str)> {
let line = raw_line.trim();
if line.is_empty() || line.starts_with('#') {
return None;
}
let (key, value_str) = line.split_once('=')?;
let key = key.trim();
let value_str = value_str.trim();
if key.is_empty() {
tracing::warn!(
path = path_display,
line = line_num,
"Skipping config line with empty key"
);
return None;
}
Some((key, value_str))
}
#[allow(dead_code)]
pub fn validate_option_key(key: &str) -> bool {
if key.is_empty() {
return false;
}
key.chars()
.all(|c| c.is_ascii_lowercase() || c.is_ascii_digit() || c == '-' || c == '_')
}