static CommandLineOptions parse(Iterable<String> options) {
    CommandLineOptions.Builder optionsBuilder = CommandLineOptions.builder();
    List<String> expandedOptions = new ArrayList<>();
    expandParamsFiles(options, expandedOptions);
    Iterator<String> it = expandedOptions.iterator();
    while (it.hasNext()) {
      String option = it.next();
      if (!option.startsWith("-")) {
        optionsBuilder.filesBuilder().add(option).addAll(it);
        break;
      }
      String flag;
      String value;
      int idx = option.indexOf('=');
      if (idx >= 0) {
        flag = option.substring(0, idx);
        value = option.substring(idx + 1);
      } else {
        flag = option;
        value = null;
      }
      // NOTE: update usage information in UsageException when new flags are added
      switch (flag) {
        case "-i":
        case "-r":
        case "-replace":
        case "--replace":
          optionsBuilder.inPlace(true);
          break;
        case "--lines":
        case "-lines":
        case "--line":
        case "-line":
          parseRangeSet(optionsBuilder.linesBuilder(), getValue(flag, it, value));
          break;
        case "--offset":
        case "-offset":
          optionsBuilder.addOffset(parseInteger(it, flag, value));
          break;
        case "--length":
        case "-length":
          optionsBuilder.addLength(parseInteger(it, flag, value));
          break;
        case "--aosp":
        case "-aosp":
        case "-a":
          optionsBuilder.aosp(true);
          break;
        case "--version":
        case "-version":
        case "-v":
          optionsBuilder.version(true);
          break;
        case "--help":
        case "-help":
        case "-h":
          optionsBuilder.help(true);
          break;
        case "--fix-imports-only":
          optionsBuilder.fixImportsOnly(true);
          break;
        case "--skip-sorting-imports":
          optionsBuilder.sortImports(false);
          break;
        case "--skip-removing-unused-imports":
          optionsBuilder.removeUnusedImports(false);
          break;
        case "--skip-reflowing-long-strings":
          optionsBuilder.reflowLongStrings(false);
          break;
        case "--skip-javadoc-formatting":
          optionsBuilder.formatJavadoc(false);
          break;
        case "-":
          optionsBuilder.stdin(true);
          break;
        case "-n":
        case "--dry-run":
          optionsBuilder.dryRun(true);
          break;
        case "--set-exit-if-changed":
          optionsBuilder.setExitIfChanged(true);
          break;
        case "-assume-filename":
        case "--assume-filename":
          optionsBuilder.assumeFilename(getValue(flag, it, value));
          break;
        default:
          throw new IllegalArgumentException("unexpected flag: " + flag);
      }
    }
    return optionsBuilder.build();
  }
@Test
  public void stdin() {
    assertThat(CommandLineOptionsParser.parse(Arrays.asList("-")).stdin()).isTrue();
  }