Minor improvements to the help system
This commit is contained in:
parent
3f96837cf1
commit
d6ce74f2d9
1 changed files with 10 additions and 1 deletions
|
|
@ -148,6 +148,8 @@ public final class CommandHelpHandler<C> {
|
||||||
final List<Command<C>> availableCommands = new LinkedList<>();
|
final List<Command<C>> availableCommands = new LinkedList<>();
|
||||||
final Set<String> availableCommandLabels = new HashSet<>();
|
final Set<String> availableCommandLabels = new HashSet<>();
|
||||||
|
|
||||||
|
boolean exactMatch = false;
|
||||||
|
|
||||||
for (final VerboseHelpEntry<C> entry : verboseEntries) {
|
for (final VerboseHelpEntry<C> entry : verboseEntries) {
|
||||||
final Command<C> command = entry.getCommand();
|
final Command<C> command = entry.getCommand();
|
||||||
@SuppressWarnings("unchecked") final StaticArgument<C> staticArgument = (StaticArgument<C>) command.getArguments()
|
@SuppressWarnings("unchecked") final StaticArgument<C> staticArgument = (StaticArgument<C>) command.getArguments()
|
||||||
|
|
@ -160,6 +162,13 @@ public final class CommandHelpHandler<C> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (final String alias : staticArgument.getAliases()) {
|
||||||
|
if (alias.equalsIgnoreCase(rootFragment)) {
|
||||||
|
exactMatch = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (rootFragment.equalsIgnoreCase(staticArgument.getName())) {
|
if (rootFragment.equalsIgnoreCase(staticArgument.getName())) {
|
||||||
availableCommandLabels.clear();
|
availableCommandLabels.clear();
|
||||||
availableCommands.clear();
|
availableCommands.clear();
|
||||||
|
|
@ -172,7 +181,7 @@ public final class CommandHelpHandler<C> {
|
||||||
/* No command found, return all possible commands */
|
/* No command found, return all possible commands */
|
||||||
if (availableCommands.isEmpty()) {
|
if (availableCommands.isEmpty()) {
|
||||||
return new IndexHelpTopic<>(Collections.emptyList());
|
return new IndexHelpTopic<>(Collections.emptyList());
|
||||||
} else if (availableCommandLabels.size() > 1) {
|
} else if (!exactMatch || availableCommandLabels.size() > 1) {
|
||||||
final List<VerboseHelpEntry<C>> syntaxHints = new ArrayList<>();
|
final List<VerboseHelpEntry<C>> syntaxHints = new ArrayList<>();
|
||||||
for (final Command<C> command : availableCommands) {
|
for (final Command<C> command : availableCommands) {
|
||||||
final List<CommandArgument<C, ?>> arguments = command.getArguments();
|
final List<CommandArgument<C, ?>> arguments = command.getArguments();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue