const VALID_TYPES: [&'static str; 26] = [
"f", "w", "d", "D", "e", "v", "q", "Q", "p", "p+", "L", "c", "b", "C", "x", "X", "r", "R", "z",
"Z", "t", "T", "h", "H", "a", "A",
];
const VALID_TYPE_MODIFIERS: [&'static str; 6] = ["+", "!", "-", "=", "~", "^"];
const VALID_SPECIFIERS: [&'static str; 25] = [
"%a", "%A", "%b", "%B", "%C", "%g", "%G", "%h", "%H", "%l", "%L", "%m", "%M", "%o", "%q", "%S",
"%t", "%T", "%u", "%U", "%v", "%V", "%w", "%W", "%%",
];
pub fn sanity_check(config_line: &Vec<&str>) -> Result<(), &'static str> {
if VALID_TYPES.contains(
&String::from(config_line[0])
.chars()
.next()
.unwrap()
.to_string()
.as_str(),
) == false
{
return Err("0");
}
if String::from(config_line[1])
.chars()
.next()
.unwrap()
.to_string()
!= "/"
{
return Err("1");
}
if config_line[2].parse::<i32>().is_err() {
if config_line[2] != "-" {
return Err("2");
}
}
Ok(())
}