use {
crate::{
cli::Args,
errors::ConfError,
},
clap::Parser,
lazy_regex::*,
};
pub fn parse_default_flags(s: &str) -> Result<Args, ConfError> {
let prefixed;
let mut tokens: Vec<&str> = if regex_is_match!("^[a-zA-Z]+$", s) {
prefixed = format!("-{s}");
vec![&prefixed]
} else {
splitty::split_unquoted_whitespace(s).collect()
};
tokens.insert(0, "broot");
Args::try_parse_from(&tokens).map_err(|_| ConfError::InvalidDefaultFlags {
flags: s.to_string(),
})
}