-/// A helper to determine message formatting
-pub enum DidYouMeanMessageStyle {
- /// Suggested value is a long flag
- LongFlag,
- /// Suggested value is one of various possible values
- EnumValue,
+/// Returns a suffix that can be empty, or is the standard 'did you mean' phrase
+pub fn did_you_mean_value_suffix<'z, T, I>(arg: &str, values: I) -> (String, Option<&'z str>)
+ where T: AsRef<str> + 'z,
+ I: IntoIterator<Item = &'z T>
+{
+ match did_you_mean(arg, values) {
+ Some(candidate) => {
+ let suffix = format!("\n\tDid you mean '{}'?", Format::Good(candidate));
+ (suffix, Some(candidate))
+ }
+ None => (String::new(), None),
+ }