private static void addRcFileArgument(Map<String, String> envs,
                                        List<String> arguments,
                                        List<String> result,
                                        String rcFilePath, String rcfileOption) {
    result.add(rcfileOption);
    result.add(rcFilePath);
    int idx = arguments.indexOf(rcfileOption);
    if (idx >= 0) {
      arguments.remove(idx);
      if (idx < arguments.size()) {
        String userRcFile = FileUtil.expandUserHome(arguments.get(idx));
        // do not set the same RC file path to avoid sourcing recursion
        if (!userRcFile.equals(rcFilePath)) {
          envs.put(JEDITERM_USER_RCFILE, FileUtil.expandUserHome(arguments.get(idx)));
        }
        arguments.remove(idx);
      }
    }
  }
private static void addRcFileArgument(Map<String, String> envs,
                                        List<String> arguments,
                                        List<String> result,
                                        String rcFilePath, String rcfileOption)