code: @Override
      public int complete(CommandContext ctx, String buffer, int cursor, List<String> candidates) {
  
          int nextCharIndex = 0;
          while (nextCharIndex < buffer.length()) {
              if (!Character.isWhitespace(buffer.charAt(nextCharIndex))) {
                  break;
              }
              ++nextCharIndex;
          }
  
          final Collection<String> all = candidatesProvider.getAllCandidates(ctx);
          if (all.isEmpty()) {
              return -1;
          }
  
          String opBuffer = buffer.substring(nextCharIndex).trim();
          if (opBuffer.isEmpty()) {
              candidates.addAll(all);
          } else {
              for (String name : all) {
                  if (name.startsWith(opBuffer)) {
                      candidates.add(name);
                  }
              }
              Collections.sort(candidates);
          }
          return nextCharIndex;
      }
docs: /* (non-Javadoc)
  @see org.jboss.as.cli.CommandLineCompleter#complete(org.jboss.as.cli.CommandContext, java.lang.String, int, java.util.List)