Skip to content
Browse files

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

  • Loading branch information...
1 parent 1e47d72 commit 4561606cf688c94e93d3290a0fe571001611aeda @harrah committed
Showing with 1 addition and 1 deletion.
  1. +1 −1 main/Command.scala
View
2 main/Command.scala
@@ -125,7 +125,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] =

0 comments on commit 4561606

Please sign in to comment.
Something went wrong with that request. Please try again.