This commit is contained in:
Eric Bottard
2017-08-30 19:06:26 +02:00
parent 993f49a81f
commit 73bf00bb44
2 changed files with 25 additions and 7 deletions

View File

@@ -284,7 +284,7 @@ public class Shell implements CommandRegistry {
*/
private String findLongestCommand(String prefix) {
String result = methodTargets.keySet().stream()
.filter(prefix::startsWith)
.filter(command -> prefix.equals(command) || prefix.startsWith(command + " "))
.reduce("", (c1, c2) -> c1.length() > c2.length() ? c1 : c2);
return "".equals(result) ? null : result;
}