Skip to content

Commit cd66fb5

Browse files
matanlureykorca0220
authored andcommitted
Adds (defaults to ___) when using flutter config --help (flutter#172329)
Closes flutter#81665.
1 parent 8bade15 commit cd66fb5

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

packages/flutter_tools/lib/src/commands/config.dart

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,12 @@ class ConfigCommand extends FlutterCommand {
6767
if (configSetting == null) {
6868
continue;
6969
}
70-
argParser.addFlag(configSetting, help: feature.generateHelpMessage());
70+
final String channel = globals.flutterVersion.channel;
71+
argParser.addFlag(
72+
configSetting,
73+
help: feature.generateHelpMessage(),
74+
defaultsTo: feature.getSettingForChannel(channel).enabledByDefault,
75+
);
7176
}
7277
argParser.addFlag(
7378
'clear-features',

packages/flutter_tools/test/commands.shard/hermetic/config_test.dart

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,13 @@ void main() {
5959
);
6060
});
6161

62+
testUsingContext('prints default values with --help', () async {
63+
final configCommand = ConfigCommand();
64+
final CommandRunner<void> commandRunner = createTestCommandRunner(configCommand);
65+
await commandRunner.run(<String>['config', '--help']);
66+
expect(testLogger.statusText, contains('(defaults to on)'));
67+
});
68+
6269
testUsingContext('throws error on excess arguments', () {
6370
final configCommand = ConfigCommand();
6471
final CommandRunner<void> commandRunner = createTestCommandRunner(configCommand);

0 commit comments

Comments
 (0)