Unverified Commit dc481b23 authored by Michael Thomsen's avatar Michael Thomsen Committed by GitHub

Cleanup flutter config output (#122384)

parent d4f884e0
...@@ -239,21 +239,17 @@ class Feature { ...@@ -239,21 +239,17 @@ class Feature {
if (configSetting == null) { if (configSetting == null) {
return null; return null;
} }
final StringBuffer buffer = StringBuffer('Enable or disable $name. ' final StringBuffer buffer = StringBuffer('Enable or disable $name.');
'This setting will take effect on ');
final List<String> channels = <String>[ final List<String> channels = <String>[
if (master.available) 'master', if (master.available) 'master',
if (beta.available) 'beta', if (beta.available) 'beta',
if (stable.available) 'stable', if (stable.available) 'stable',
]; ];
// Add channel info for settings only on some channels.
if (channels.length == 1) { 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) { } else if (channels.length == 2) {
buffer.write('the ${channels.join(' and ')} channels.'); buffer.write('\nThis setting applies to only the ${channels.join(' and ')} channels.');
} else {
final String prefix = (channels.toList()
..removeLast()).join(', ');
buffer.write('the $prefix, and ${channels.last} channels.');
} }
if (extraHelpText != null) { if (extraHelpText != null) {
buffer.write(' $extraHelpText'); buffer.write(' $extraHelpText');
......
...@@ -89,26 +89,22 @@ void main() { ...@@ -89,26 +89,22 @@ void main() {
testWithoutContext('Flutter web help string', () { testWithoutContext('Flutter web help string', () {
expect(flutterWebFeature.generateHelpMessage(), expect(flutterWebFeature.generateHelpMessage(),
'Enable or disable Flutter for web. ' 'Enable or disable Flutter for web.');
'This setting will take effect on the master, beta, and stable channels.');
}); });
testWithoutContext('Flutter macOS desktop help string', () { testWithoutContext('Flutter macOS desktop help string', () {
expect(flutterMacOSDesktopFeature.generateHelpMessage(), expect(flutterMacOSDesktopFeature.generateHelpMessage(),
'Enable or disable support for desktop on macOS. ' 'Enable or disable support for desktop on macOS.');
'This setting will take effect on the master, beta, and stable channels.');
}); });
testWithoutContext('Flutter Linux desktop help string', () { testWithoutContext('Flutter Linux desktop help string', () {
expect(flutterLinuxDesktopFeature.generateHelpMessage(), expect(flutterLinuxDesktopFeature.generateHelpMessage(),
'Enable or disable support for desktop on Linux. ' 'Enable or disable support for desktop on Linux.');
'This setting will take effect on the master, beta, and stable channels.');
}); });
testWithoutContext('Flutter Windows desktop help string', () { testWithoutContext('Flutter Windows desktop help string', () {
expect(flutterWindowsDesktopFeature.generateHelpMessage(), expect(flutterWindowsDesktopFeature.generateHelpMessage(),
'Enable or disable support for desktop on Windows. ' 'Enable or disable support for desktop on Windows.');
'This setting will take effect on the master, beta, and stable channels.');
}); });
testWithoutContext('help string on multiple channels', () { testWithoutContext('help string on multiple channels', () {
...@@ -120,8 +116,7 @@ void main() { ...@@ -120,8 +116,7 @@ void main() {
configSetting: 'foo', configSetting: 'foo',
); );
expect(testWithoutContextFeature.generateHelpMessage(), 'Enable or disable example. ' expect(testWithoutContextFeature.generateHelpMessage(), 'Enable or disable example.');
'This setting will take effect on the master, beta, and stable channels.');
}); });
/// Flutter Web /// Flutter Web
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment