Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup flutter config output #122384

Merged
merged 7 commits into from
Apr 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 4 additions & 8 deletions packages/flutter_tools/lib/src/features.dart
Original file line number Diff line number Diff line change
Expand Up @@ -239,21 +239,17 @@ class Feature {
if (configSetting == null) {
return null;
}
final StringBuffer buffer = StringBuffer('Enable or disable $name. '
'This setting will take effect on ');
final StringBuffer buffer = StringBuffer('Enable or disable $name.');
final List<String> channels = <String>[
if (master.available) 'master',
if (beta.available) 'beta',
if (stable.available) 'stable',
];
// Add channel info for settings only on some channels.
if (channels.length == 1) {
buffer.write('the ${channels.single} channel.');
buffer.write('\nThis setting applies to only the ${channels.single} channel.');
} else if (channels.length == 2) {
buffer.write('the ${channels.join(' and ')} channels.');
} else {
final String prefix = (channels.toList()
..removeLast()).join(', ');
buffer.write('the $prefix, and ${channels.last} channels.');
buffer.write('\nThis setting applies to only the ${channels.join(' and ')} channels.');
}
if (extraHelpText != null) {
buffer.write(' $extraHelpText');
Expand Down
15 changes: 5 additions & 10 deletions packages/flutter_tools/test/general.shard/features_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -89,26 +89,22 @@ void main() {

testWithoutContext('Flutter web help string', () {
expect(flutterWebFeature.generateHelpMessage(),
'Enable or disable Flutter for web. '
'This setting will take effect on the master, beta, and stable channels.');
'Enable or disable Flutter for web.');
});

testWithoutContext('Flutter macOS desktop help string', () {
expect(flutterMacOSDesktopFeature.generateHelpMessage(),
'Enable or disable support for desktop on macOS. '
'This setting will take effect on the master, beta, and stable channels.');
'Enable or disable support for desktop on macOS.');
});

testWithoutContext('Flutter Linux desktop help string', () {
expect(flutterLinuxDesktopFeature.generateHelpMessage(),
'Enable or disable support for desktop on Linux. '
'This setting will take effect on the master, beta, and stable channels.');
'Enable or disable support for desktop on Linux.');
});

testWithoutContext('Flutter Windows desktop help string', () {
expect(flutterWindowsDesktopFeature.generateHelpMessage(),
'Enable or disable support for desktop on Windows. '
'This setting will take effect on the master, beta, and stable channels.');
'Enable or disable support for desktop on Windows.');
});

testWithoutContext('help string on multiple channels', () {
Expand All @@ -120,8 +116,7 @@ void main() {
configSetting: 'foo',
);

expect(testWithoutContextFeature.generateHelpMessage(), 'Enable or disable example. '
'This setting will take effect on the master, beta, and stable channels.');
expect(testWithoutContextFeature.generateHelpMessage(), 'Enable or disable example.');
});

/// Flutter Web
Expand Down