Skip to content

Commit 91eb2f5

Browse files
devoncarewcommit-bot@chromium.org
authored andcommitted
[analyzer] rename the dartfix --include <fix> option to dartfix --fix <fix>
Change-Id: Ibd5d8c45912a292e1a787e88ddb06e730ebda0a9 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109548 Reviewed-by: Dan Rubel <[email protected]> Commit-Queue: Devon Carew <[email protected]>
1 parent 53bda39 commit 91eb2f5

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

pkg/dartfix/lib/src/options.dart

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ import 'package:cli_util/cli_logging.dart';
99
import 'package:dartfix/src/context.dart';
1010
import 'package:path/path.dart' as path;
1111

12-
const excludeOption = 'exclude';
13-
1412
const forceOption = 'force';
15-
const includeOption = 'include';
13+
const includeOption = 'fix';
14+
const excludeOption = 'exclude';
1615
const overwriteOption = 'overwrite';
1716
const requiredOption = 'required';
17+
1818
const _binaryName = 'dartfix';
1919
const _colorOption = 'color';
2020
const _serverSnapshot = 'server';
@@ -44,10 +44,8 @@ class Options {
4444

4545
Options._fromArgs(this.context, ArgResults results)
4646
: force = results[forceOption] as bool,
47-
includeFixes =
48-
(results[includeOption] as List ?? []).cast<String>().toList(),
49-
excludeFixes =
50-
(results[excludeOption] as List ?? []).cast<String>().toList(),
47+
includeFixes = (results[includeOption] as List ?? []).cast<String>(),
48+
excludeFixes = (results[excludeOption] as List ?? []).cast<String>(),
5149
overwrite = results[overwriteOption] as bool,
5250
requiredFixes = results[requiredOption] as bool,
5351
sdkPath = _getSdkPath(),
@@ -57,7 +55,9 @@ class Options {
5755
useColor = results.wasParsed(_colorOption)
5856
? results[_colorOption] as bool
5957
: null,
60-
verbose = results[_verboseOption] as bool;
58+
verbose = results[_verboseOption] as bool {
59+
includeFixes.addAll((results['include'] as List ?? []).cast<String>());
60+
}
6161

6262
String makeAbsoluteAndNormalize(String target) {
6363
if (!path.isAbsolute(target)) {
@@ -70,7 +70,10 @@ class Options {
7070
final parser = ArgParser(allowTrailingOptions: true)
7171
..addSeparator('Choosing fixes to be applied:')
7272
..addMultiOption(includeOption,
73-
abbr: 'i', help: 'Include a specific fix.', valueHelp: 'name-of-fix')
73+
help: 'Include a specific fix.', valueHelp: 'name-of-fix')
74+
// 'include' is an alias for 'fix' (above)
75+
..addMultiOption('include',
76+
help: 'Include a specific fix.', valueHelp: 'name-of-fix', hide: true)
7477
..addMultiOption(excludeOption,
7578
abbr: 'x', help: 'Exclude a specific fix.', valueHelp: 'name-of-fix')
7679
..addFlag(requiredOption,

pkg/dartfix/test/src/driver_include_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ main() {
2424
final testLogger = TestLogger();
2525
String exampleSource = await exampleFile.readAsString();
2626

27-
await driver.start(['-iuse-mixin', exampleDir.path],
27+
await driver.start(['--fix', 'use-mixin', exampleDir.path],
2828
testContext: testContext, testLogger: testLogger);
2929
if (_debug) {
3030
print(testLogger.stderrBuffer.toString());

0 commit comments

Comments
 (0)