@Override
  public List<InterpreterCompletion> completion(String buf, int cursor,
      InterpreterContext interpreterContext) {
    String[] words = splitAndRemoveEmpty(splitAndRemoveEmpty(buf, "\n"), " ");
    String lastWord = "";
    if (words.length > 0) {
      lastWord = words[ words.length - 1 ];
    }
    
    List<InterpreterCompletion>  voices = new LinkedList<>();
    for (String command : keywords) {
      if (command.startsWith(lastWord)) {
        voices.add(new InterpreterCompletion(command, command, CompletionType.command.name()));
      }
    }
    return voices;
  }
@Test
  void testCompletion() {
    List<InterpreterCompletion> expectedResultOne = Arrays.asList(
        new InterpreterCompletion("cat", "cat", CompletionType.command.name()),
        new InterpreterCompletion("chgrp", "chgrp", CompletionType.command.name()),
        new InterpreterCompletion("chmod", "chmod", CompletionType.command.name()),
        new InterpreterCompletion("chown", "chown", CompletionType.command.name()),
        new InterpreterCompletion("copyFromLocal", "copyFromLocal", CompletionType.command.name()),
        new InterpreterCompletion("copyToLocal", "copyToLocal", CompletionType.command.name()),
        new InterpreterCompletion("count", "count", CompletionType.command.name()),
        new InterpreterCompletion("createLineage", "createLineage", CompletionType.command.name()));
    List<InterpreterCompletion> expectedResultTwo = Arrays.asList(
        new InterpreterCompletion("copyFromLocal", "copyFromLocal",
              CompletionType.command.name()),
        new InterpreterCompletion("copyToLocal", "copyToLocal",
              CompletionType.command.name()),
        new InterpreterCompletion("count", "count", CompletionType.command.name()));
    List<InterpreterCompletion> expectedResultThree = Arrays.asList(
        new InterpreterCompletion("copyFromLocal", "copyFromLocal",
              CompletionType.command.name()),
        new InterpreterCompletion("copyToLocal", "copyToLocal",
              CompletionType.command.name()));
    List<InterpreterCompletion> expectedResultNone = new ArrayList<>();

    List<InterpreterCompletion> resultOne = alluxioInterpreter.completion("c", 0, null);
    List<InterpreterCompletion> resultTwo = alluxioInterpreter.completion("co", 0, null);
    List<InterpreterCompletion> resultThree = alluxioInterpreter.completion("copy", 0, null);
    List<InterpreterCompletion> resultNotMatch = alluxioInterpreter.completion("notMatch", 0, null);
    List<InterpreterCompletion> resultAll = alluxioInterpreter.completion("", 0, null);

    assertEquals(expectedResultOne, resultOne);
    assertEquals(expectedResultTwo, resultTwo);
    assertEquals(expectedResultThree, resultThree);
    assertEquals(expectedResultNone, resultNotMatch);

    List<String> allCompletionList = new ArrayList<>();
    for (InterpreterCompletion ic : resultAll) {
      allCompletionList.add(ic.getName());
    }
    assertEquals(alluxioInterpreter.keywords, allCompletionList);
  }