fix: show page numbers on tab complete

This commit is contained in:
Sekwah 2023-04-12 15:29:33 +01:00
parent c861333304
commit 59b609415d
No known key found for this signature in database
GPG Key ID: 9E0D654FC942286D
1 changed files with 4 additions and 0 deletions

View File

@ -117,6 +117,10 @@ public class CommandWithSubCommands implements CommandTemplate {
if(args.length > 1) {
if(args[0].equalsIgnoreCase("help")) {
List<String> allowedCommands = new ArrayList<>(this.subCommandRegistry.getSubCommands());
int pages = (int) Math.ceil(allowedCommands.size() / (float) this.subCommandsPerPage);
for (int i = 1; i <= pages; i++) {
allowedCommands.add(String.valueOf(i));
}
Collections.sort(allowedCommands);
return this.filterTabResults(allowedCommands, args[args.length - 1]);
}