Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ static CommandLineOptions parse(Iterable<String> options) {
case "--offset", "-offset" -> optionsBuilder.addOffset(parseInteger(it, flag, value));
case "--length", "-length" -> optionsBuilder.addLength(parseInteger(it, flag, value));
case "--aosp", "-aosp", "-a" -> optionsBuilder.aosp(true);
case "--no-aosp", "-no-aosp" -> optionsBuilder.aosp(false);
case "--version", "-version", "-v" -> optionsBuilder.version(true);
case "--help", "-help", "-h" -> optionsBuilder.help(true);
case "--fix-imports-only" -> optionsBuilder.fixImportsOnly(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ final class UsageException extends Exception {
File name to use for diagnostics when formatting standard input (default is <stdin>).
--aosp, -aosp, -a
Use AOSP style instead of Google Style (4-space indentation).
--no-aosp, -no-aosp
Use Google Style (2-space indentation). If both --aosp and --no-aosp are given, the last
one wins.
--fix-imports-only
Fix import order and remove any unused imports, but do no other formatting.
--skip-sorting-imports
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,15 @@ public void aosp() {
assertThat(CommandLineOptionsParser.parse(Arrays.asList("-aosp")).aosp()).isTrue();
}

@Test
public void noAosp() {
assertThat(CommandLineOptionsParser.parse(Arrays.asList("--no-aosp")).aosp()).isFalse();
assertThat(CommandLineOptionsParser.parse(Arrays.asList("--aosp", "--no-aosp")).aosp())
.isFalse();
assertThat(CommandLineOptionsParser.parse(Arrays.asList("--no-aosp", "--aosp")).aosp())
.isTrue();
}

@Test
public void help() {
assertThat(CommandLineOptionsParser.parse(Arrays.asList("-help")).help()).isTrue();
Expand Down