Polish empty string checks
See gh-23550
This commit is contained in:
committed by
Stephane Nicoll
parent
294af45bb3
commit
5cb07e292d
@@ -33,6 +33,7 @@ import jline.console.completer.StringsCompleter;
|
||||
import org.springframework.boot.cli.command.Command;
|
||||
import org.springframework.boot.cli.command.options.OptionHelp;
|
||||
import org.springframework.boot.cli.util.Log;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* JLine {@link Completer} for Spring Boot {@link Command}s.
|
||||
@@ -74,7 +75,7 @@ public class CommandCompleter extends StringsCompleter {
|
||||
int completionIndex = super.complete(buffer, cursor, candidates);
|
||||
int spaceIndex = buffer.indexOf(' ');
|
||||
String commandName = ((spaceIndex != -1) ? buffer.substring(0, spaceIndex) : "");
|
||||
if (!"".equals(commandName.trim())) {
|
||||
if (StringUtils.hasText(commandName)) {
|
||||
for (Command command : this.commands) {
|
||||
if (command.getName().equals(commandName)) {
|
||||
if (cursor == buffer.length() && buffer.endsWith(" ")) {
|
||||
|
||||
Reference in New Issue
Block a user