Always show "--set-exit-if-changed" in help.
diff --git a/lib/src/cli/options.dart b/lib/src/cli/options.dart
index e6f5aba..b018cde 100644
--- a/lib/src/cli/options.dart
+++ b/lib/src/cli/options.dart
@@ -23,7 +23,7 @@
help: 'Show all options and flags with --help.');
}
- if (verbose) parser.addSeparator('Common options:');
+ if (verbose) parser.addSeparator('Output options:');
if (oldCli) {
parser.addFlag('overwrite',
@@ -68,6 +68,10 @@
hide: !verbose);
}
+ parser.addFlag('set-exit-if-changed',
+ negatable: false,
+ help: 'Return exit code 1 if there are any formatting changes.');
+
if (verbose) parser.addSeparator('Non-whitespace fixes (off by default):');
parser.addFlag('fix', negatable: false, help: 'Apply all style fixes.');
@@ -93,10 +97,6 @@
help: 'Produce machine-readable JSON output.',
hide: !verbose);
}
- parser.addFlag('set-exit-if-changed',
- negatable: false,
- help: 'Return exit code 1 if there are any formatting changes.',
- hide: !verbose);
parser.addFlag('follow-links',
negatable: false,
help: 'Follow links to files and directories.\n'
diff --git a/test/command_line_test.dart b/test/command_line_test.dart
index c02a2d2..54d2034 100644
--- a/test/command_line_test.dart
+++ b/test/command_line_test.dart
@@ -121,9 +121,9 @@
await expectLater(process.stdout,
emits('Usage: dartfmt [options...] [files or directories...]'));
await expectLater(process.stdout, emitsThrough(contains('--overwrite')));
- await expectLater(process.stdout, emitsThrough(contains('--fix')));
await expectLater(
- process.stdout, neverEmits(contains('--set-exit-if-changed')));
+ process.stdout, emitsThrough(contains('--set-exit-if-changed')));
+ await expectLater(process.stdout, emitsThrough(contains('--fix')));
await process.shouldExit(0);
});
@@ -135,9 +135,9 @@
await expectLater(process.stdout,
emits('Usage: dartfmt [options...] [files or directories...]'));
await expectLater(process.stdout, emitsThrough(contains('--overwrite')));
- await expectLater(process.stdout, emitsThrough(contains('--fix')));
await expectLater(
process.stdout, emitsThrough(contains('--set-exit-if-changed')));
+ await expectLater(process.stdout, emitsThrough(contains('--fix')));
await process.shouldExit(0);
});
});