don't suggest similar keys for strings with only 1 or 2 characters

This commit is contained in:
Mark Harrah 2011-12-12 19:24:58 -05:00
parent 426acdf3f9
commit 34a39740c7
1 changed files with 1 additions and 1 deletions

View File

@ -129,7 +129,7 @@ object Command
"Not a valid " + label + ": " + value + similar(value, allowed)
def similar(value: String, allowed: Iterable[String]): String =
{
val suggested = suggestions(value, allowed.toSeq)
val suggested = if(value.length > 2) suggestions(value, allowed.toSeq) else Nil
if(suggested.isEmpty) "" else suggested.mkString(" (similar: ", ", ", ")")
}
def suggestions(a: String, bs: Seq[String], maxDistance: Int = 3, maxSuggestions: Int = 3): Seq[String] =