public String getHint(String buffer) {
    List<String> topicKeys = topics.keySet()
        .stream()
        .filter(t -> buffer == null || t.toLowerCase().startsWith(buffer.toLowerCase()))
        .sorted()
        .collect(Collectors.toList());

    StringBuilder builder = new StringBuilder();
    // if no topic is provided, return a list of topics
    if (topicKeys.isEmpty()) {
      builder.append(CliStrings.format(CliStrings.HINT__MSG__UNKNOWN_TOPIC, buffer))
          .append(LINE_SEPARATOR).append(LINE_SEPARATOR);
    } else if (topicKeys.size() == 1) {
      Topic oneTopic = topics.get(topicKeys.get(0));
      builder.append(oneTopic.desc).append(LINE_SEPARATOR)
          .append(LINE_SEPARATOR);
      oneTopic.relatedCommands.stream().sorted().forEach(command -> builder.append(command.command)
          .append(": ").append(command.desc).append(LINE_SEPARATOR));
    } else {
      builder.append(CliStrings.HINT__MSG__TOPICS_AVAILABLE).append(LINE_SEPARATOR)
          .append(LINE_SEPARATOR);

      topicKeys.forEach(topic -> builder.append(topic).append(LINE_SEPARATOR));
    }

    return builder.toString();
  }
get help string for a specific command, or a brief description of all the commands if buffer is
null or empty
geode-gfsh/src/main/java/org/apache/geode/management/internal/cli/help/Helper.java