Class CommandLineOptionsParser

java.lang.Object
com.google.googlejavaformat.java.CommandLineOptionsParser

final class CommandLineOptionsParser extends Object
A parser for CommandLineOptions.
  • Field Details

    • COMMA_SPLITTER

      private static final com.google.common.base.Splitter COMMA_SPLITTER
    • COLON_SPLITTER

      private static final com.google.common.base.Splitter COLON_SPLITTER
    • ARG_SPLITTER

      private static final com.google.common.base.Splitter ARG_SPLITTER
  • Constructor Details

    • CommandLineOptionsParser

      CommandLineOptionsParser()
  • Method Details

    • parse

      static CommandLineOptions parse(Iterable<String> options)
    • parseInteger

      private static Integer parseInteger(Iterator<String> it, String flag, String value)
    • getValue

      private static String getValue(String flag, Iterator<String> it, String value)
    • parseRangeSet

      private static void parseRangeSet(com.google.common.collect.RangeSet<Integer> result, String ranges)
      Parse multiple --lines flags, like {"1:12,14,20:36", "40:45,50"}. Multiple ranges can be given with multiple --lines flags or separated by commas. A single line can be set by a single number. Line numbers are 1-based, but are converted to the 0-based numbering used internally by google-java-format.
    • parseRange

      private static com.google.common.collect.Range<Integer> parseRange(String arg)
      Parse a range, as in "1:12" or "42". Line numbers provided are 1-based, but are converted here to 0-based.
    • expandParamsFiles

      private static void expandParamsFiles(Iterable<String> args, List<String> expanded)
      Pre-processes an argument list, expanding arguments of the form @filename by reading the content of the file and appending whitespace-delimited options to arguments.