/** @deprecated Unstable API */ @Deprecated @UnstableAPI public CommandHelp generateCommandHelp(CommandIssuer issuer, RootCommand rootCommand) { verifyUnstableAPI("help"); return new CommandHelp(this, rootCommand, issuer); }
/** * Override this to control replacements * * @param help * @return */ public String[] getHeaderFooterFormatReplacements(CommandHelp help) { return new String[]{ "{search}", help.search != null ? String.join(" ", help.search) : "", "{command}", help.getCommandName(), "{commandprefix}", help.getCommandPrefix(), "{rootcommand}", help.getCommandName(), "{page}", "" + help.getPage(), "{totalpages}", "" + help.getTotalPages(), "{results}", "" + help.getTotalResults() }; }
public void setSearch(List<String> search) { this.search = search; getHelpEntries().forEach(this::updateSearchScore); }
commandHelp.setPage(page); Integer perPage = c.getFlagValue("perpage", (Integer) null); if (perPage != null) { commandHelp.setPerPage(perPage); if (commandHelp.isExactMatch(cmd)) { return commandHelp; commandHelp.setSearch(search); return commandHelp; });
/** * Override this to control replacements * * @param help * @param param * @param entry * @return */ @NotNull public String[] getParameterFormatReplacements(CommandHelp help, CommandParameter param, HelpEntry entry) { //{name} {description} return new String[]{ "{name}", param.getName(), "{syntax}", ACFUtil.nullDefault(param.getSyntax(), ""), "{description}", ACFUtil.nullDefault(param.getDescription(), ""), "{command}", help.getCommandName(), "{fullcommand}", entry.getCommand(), "{commandprefix}", help.getCommandPrefix() }; } }
public void showAllResults(CommandHelp commandHelp, List<HelpEntry> entries) { CommandIssuer issuer = commandHelp.getIssuer(); printHelpHeader(commandHelp, issuer); for (HelpEntry e : entries) { printHelpCommand(commandHelp, issuer, e); } printHelpFooter(commandHelp, issuer); }
public String getCommandPrefix() { return this.commandHelp.getCommandPrefix(); }
public void printHelpFooter(CommandHelp help, CommandIssuer issuer) { if (help.isLastPage()) { return; } issuer.sendMessage(MessageType.HELP, MessageKeys.HELP_PAGE_INFORMATION, getHeaderFooterFormatReplacements(help)); }
public void showSearchResults(CommandHelp commandHelp, List<HelpEntry> entries) { CommandIssuer issuer = commandHelp.getIssuer(); printSearchHeader(commandHelp, issuer); for (HelpEntry e : entries) { printSearchEntry(commandHelp, issuer, e); } printSearchFooter(commandHelp, issuer); }
public void printDetailedHelpHeader(CommandHelp help, CommandIssuer issuer, HelpEntry entry) { issuer.sendMessage(MessageType.HELP, MessageKeys.HELP_DETAILED_HEADER, "{command}", entry.getCommand(), "{commandprefix}", help.getCommandPrefix() ); }
public void printSearchFooter(CommandHelp help, CommandIssuer issuer) { if (help.isLastPage()) { return; } issuer.sendMessage(MessageType.HELP, MessageKeys.HELP_PAGE_INFORMATION, getHeaderFooterFormatReplacements(help)); }
public void showDetailedHelp(CommandHelp commandHelp, HelpEntry entry) { CommandIssuer issuer = commandHelp.getIssuer(); // header printDetailedHelpHeader(commandHelp, issuer, entry); // normal help line printDetailedHelpCommand(commandHelp, issuer, entry); // additionally detailed help for params for (CommandParameter param : entry.getParameters()) { String description = param.getDescription(); if (description != null && !description.isEmpty()) { printDetailedParameter(commandHelp, issuer, entry, param); } } // footer printDetailedHelpFooter(commandHelp, issuer, entry); }
/** * Override this to control replacements * * @param help * @param entry * @return */ public String[] getEntryFormatReplacements(CommandHelp help, HelpEntry entry) { //{command} {parameters} {separator} {description} return new String[]{ "{command}", entry.getCommand(), "{commandprefix}", help.getCommandPrefix(), "{parameters}", entry.getParameterSyntax(), "{separator}", entry.getDescription().isEmpty() ? "" : "-", "{description}", entry.getDescription() }; }
List<HelpEntry> helpEntries = getHelpEntries(); Iterator<HelpEntry> results = helpEntries.stream() .filter(HelpEntry::shouldShow) if (!results.hasNext()) { issuer.sendMessage(MessageType.ERROR, MessageKeys.NO_COMMAND_MATCHED_SEARCH, "{search}", ACFUtil.join(this.search, " ")); helpEntries = getHelpEntries(); results = helpEntries.iterator();