Skip to content

Commit d6c85f4

Browse files
Dan Rubelcommit-bot@chromium.org
authored andcommitted
rename dartfix "exclude" option to "excludeFix"
This renames the "exclude" option to make it more clear exactly what is being excluded, similar to the earlier change renaming "include" to "fix". Change-Id: I07d164d480c8e389e5c7353db81e7633f0efd3d9 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109921 Reviewed-by: Devon Carew <[email protected]> Commit-Queue: Dan Rubel <[email protected]>
1 parent 1e04ff8 commit d6c85f4

File tree

5 files changed

+19
-24
lines changed

5 files changed

+19
-24
lines changed

pkg/dartfix/lib/src/driver.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,11 @@ class Driver {
8484
return true;
8585
}
8686
if (options.excludeFixes.isNotEmpty) {
87-
_unsupportedOption(excludeOption);
87+
_unsupportedOption(excludeFixOption);
8888
return false;
8989
}
9090
if (options.includeFixes.isNotEmpty) {
91-
_unsupportedOption(includeOption);
91+
_unsupportedOption(includeFixOption);
9292
return false;
9393
}
9494
if (options.requiredFixes) {
@@ -189,14 +189,14 @@ Analysis Details:
189189

190190
logger.stdout('''
191191
192-
These fixes are automatically applied unless at least one --$includeOption option is specified
193-
(and --$requiredOption is not specified). They may be individually disabled using --$excludeOption.''');
192+
These fixes are automatically applied unless at least one --$includeFixOption option is specified
193+
(and --$requiredOption is not specified). They may be individually disabled using --$excludeFixOption.''');
194194

195195
fixes.where((fix) => fix.isRequired).forEach(showFix);
196196

197197
logger.stdout('''
198198
199-
These fixes are NOT automatically applied, but may be enabled using --$includeOption:''');
199+
These fixes are NOT automatically applied, but may be enabled using --$includeFixOption:''');
200200

201201
fixes.where((fix) => !fix.isRequired).toList()
202202
..sort(compareFixes)

pkg/dartfix/lib/src/options.dart

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

1212
const forceOption = 'force';
13-
const includeOption = 'fix';
14-
const excludeOption = 'exclude';
13+
const includeFixOption = 'fix';
14+
const excludeFixOption = 'excludeFix';
1515
const overwriteOption = 'overwrite';
1616
const requiredOption = 'required';
1717

@@ -44,8 +44,8 @@ class Options {
4444

4545
Options._fromArgs(this.context, ArgResults results)
4646
: force = results[forceOption] as bool,
47-
includeFixes = (results[includeOption] as List ?? []).cast<String>(),
48-
excludeFixes = (results[excludeOption] as List ?? []).cast<String>(),
47+
includeFixes = (results[includeFixOption] as List ?? []).cast<String>(),
48+
excludeFixes = (results[excludeFixOption] as List ?? []).cast<String>(),
4949
overwrite = results[overwriteOption] as bool,
5050
requiredFixes = results[requiredOption] as bool,
5151
sdkPath = _getSdkPath(),
@@ -55,9 +55,7 @@ class Options {
5555
useColor = results.wasParsed(_colorOption)
5656
? results[_colorOption] as bool
5757
: null,
58-
verbose = results[_verboseOption] as bool {
59-
includeFixes.addAll((results['include'] as List ?? []).cast<String>());
60-
}
58+
verbose = results[_verboseOption] as bool;
6159

6260
String makeAbsoluteAndNormalize(String target) {
6361
if (!path.isAbsolute(target)) {
@@ -69,13 +67,10 @@ class Options {
6967
static Options parse(List<String> args, Context context, Logger logger) {
7068
final parser = ArgParser(allowTrailingOptions: true)
7169
..addSeparator('Choosing fixes to be applied:')
72-
..addMultiOption(includeOption,
70+
..addMultiOption(includeFixOption,
7371
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)
77-
..addMultiOption(excludeOption,
78-
abbr: 'x', help: 'Exclude a specific fix.', valueHelp: 'name-of-fix')
72+
..addMultiOption(excludeFixOption,
73+
help: 'Exclude a specific fix.', valueHelp: 'name-of-fix')
7974
..addFlag(requiredOption,
8075
abbr: 'r',
8176
help: 'Apply required fixes.',
@@ -203,7 +198,7 @@ Usage: $_binaryName [options...] <directory paths>
203198
? '''
204199
205200
Use --$_helpOption to display the fixes that can be specified using either
206-
--$includeOption or --$excludeOption.'''
201+
--$includeFixOption or --$excludeFixOption.'''
207202
: '');
208203
}
209204
}

pkg/dartfix/test/src/driver_exclude_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(debug: _debug);
2525
String exampleSource = await exampleFile.readAsString();
2626

27-
var args = ['-xuse-mixin', exampleDir.path];
27+
var args = ['--excludeFix', 'use-mixin', exampleDir.path];
2828
if (_debug) {
2929
args.add('-v');
3030
}

pkg/dartfix/test/src/driver_help_test.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ main() {
2626
final errText = testLogger.stderrBuffer.toString();
2727
final outText = testLogger.stdoutBuffer.toString();
2828
expect(errText, isEmpty);
29-
expect(outText, contains('--$excludeOption'));
29+
expect(outText, contains('--$excludeFixOption'));
3030
expect(outText, isNot(contains('Use --help to display the fixes')));
3131
expect(outText, contains('use-mixin'));
3232
});
@@ -50,7 +50,7 @@ main() {
5050
print(errText);
5151
print(outText);
5252
expect(errText, isEmpty);
53-
expect(outText, contains('--$excludeOption'));
53+
expect(outText, contains('--$excludeFixOption'));
5454
expect(outText, isNot(contains('Use --help to display the fixes')));
5555
expect(outText, contains('use-mixin'));
5656
});

pkg/dartfix/test/src/options_test.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ main() {
7373
}
7474

7575
test('exclude fix', () {
76-
parse(['--exclude', 'c', '--exclude', 'd', 'foo'],
76+
parse(['--excludeFix', 'c', '--excludeFix', 'd', 'foo'],
7777
excludeFixes: ['c', 'd'], targetSuffixes: ['foo']);
7878
});
7979

@@ -90,7 +90,7 @@ main() {
9090
});
9191

9292
test('include fix', () {
93-
parse(['--include', 'a', '--include', 'b', 'foo'],
93+
parse(['--fix', 'a', '--fix', 'b', 'foo'],
9494
includeFixes: ['a', 'b'], targetSuffixes: ['foo']);
9595
});
9696

0 commit comments

Comments
 (0)