Would be cleaner to use properly named strings for this enum? E.g:
"both" => Ok(Self::Both),
"single" => Ok(Self::IndividualInputs),
"combined" => Ok(Self::AllInputs),
other => Err(exit_help(&format!(
"Invalid coverage check mode '{other}'. Expected 'both', 'single', or 'combined'"
))),
Possibly this could just be a single bool without any extra class and with proper named args:
let mut check_individual = true; // default is "both"
// skip the pos args (everything after is a named arg)
for arg in env::args().skip(5) {
if let Some(value) = arg.strip_prefix("--mode=") {
check_individual = match value {
"both" => true,
"combined" => false,
other => return Err(help(&format!(
"Invalid mode '{other}'. Expected 'both' or 'combined'"
))),
};
}else {
return Err(help(&format!("Too many args, or unknown named arg: {arg}")));
}
}
The rationale being that there should be no reason to skip the full combined check, only the expensive single check. Otherwise, two boolean flags are still simpler than a full enum class for this?