Skip to content

Commit a1bf03f

Browse files
authored
Revert "Esarbanis flutter run help (flutter#48314)" (flutter#48351)
This reverts commit 866fa64.
1 parent 134c2ff commit a1bf03f

File tree

8 files changed

+70
-336
lines changed

8 files changed

+70
-336
lines changed

AUTHORS

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,3 @@ Robin Jespersen <info@unitedpartners.de>
4949
Jefferson Quesado <jeff.quesado@gmail.com>
5050
Mark Diener <rpzrpzrpz@gmail.com>
5151
Alek Åström <alek.astrom@gmail.com>
52-
Efthymios Sarpmpanis <e.sarbanis@gmail.com>

packages/flutter_tools/lib/src/base/command_help.dart

Lines changed: 0 additions & 76 deletions
This file was deleted.

packages/flutter_tools/lib/src/resident_runner.dart

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import 'package:meta/meta.dart';
99
import 'application_package.dart';
1010
import 'artifacts.dart';
1111
import 'asset.dart';
12-
import 'base/command_help.dart';
1312
import 'base/common.dart';
1413
import 'base/file_system.dart';
1514
import 'base/io.dart' as io;
@@ -1004,30 +1003,23 @@ abstract class ResidentRunner {
10041003
void printHelp({ @required bool details });
10051004

10061005
void printHelpDetails() {
1007-
if (flutterDevices.any((FlutterDevice d) => d.device.supportsScreenshot)) {
1008-
CommandHelp.s.print();
1009-
}
10101006
if (supportsServiceProtocol) {
1011-
CommandHelp.w.print();
1012-
CommandHelp.t.print();
1007+
globals.printStatus('You can dump the widget hierarchy of the app (debugDumpApp) by pressing "w".');
1008+
globals.printStatus('To dump the rendering tree of the app (debugDumpRenderTree), press "t".');
10131009
if (isRunningDebug) {
1014-
CommandHelp.L.print();
1015-
CommandHelp.S.print();
1016-
CommandHelp.U.print();
1017-
CommandHelp.i.print();
1018-
CommandHelp.p.print();
1019-
CommandHelp.o.print();
1020-
CommandHelp.z.print();
1010+
globals.printStatus('For layers (debugDumpLayerTree), use "L"; for accessibility (debugDumpSemantics), use "S" (for traversal order) or "U" (for inverse hit test order).');
1011+
globals.printStatus('To toggle the widget inspector (WidgetsApp.showWidgetInspectorOverride), press "i".');
1012+
globals.printStatus('To toggle the display of construction lines (debugPaintSizeEnabled), press "p".');
1013+
globals.printStatus('To simulate different operating systems, (defaultTargetPlatform), press "o".');
1014+
globals.printStatus('To toggle the elevation checker, press "z".');
10211015
} else {
1022-
CommandHelp.S.print();
1023-
CommandHelp.U.print();
1016+
globals.printStatus('To dump the accessibility tree (debugDumpSemantics), press "S" (for traversal order) or "U" (for inverse hit test order).');
10241017
}
1025-
// `P` should precede `a`
1026-
CommandHelp.P.print();
1027-
CommandHelp.a.print();
1018+
globals.printStatus('To display the performance overlay (WidgetsApp.showPerformanceOverlay), press "P".');
1019+
globals.printStatus('To enable timeline events for all widget build methods, (debugProfileWidgetBuilds), press "a"');
10281020
}
10291021
if (flutterDevices.any((FlutterDevice d) => d.device.supportsScreenshot)) {
1030-
CommandHelp.s.print();
1022+
globals.printStatus('To save a screenshot to flutter.png, press "s".');
10311023
}
10321024
}
10331025

packages/flutter_tools/lib/src/run_cold.dart

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import 'dart:async';
66

77
import 'package:meta/meta.dart';
88

9-
import 'base/command_help.dart';
109
import 'base/file_system.dart';
1110
import 'device.dart';
1211
import 'globals.dart' as globals;
@@ -180,24 +179,32 @@ class ColdRunner extends ResidentRunner {
180179

181180
@override
182181
void printHelp({ @required bool details }) {
183-
globals.printStatus('Flutter run key commands.');
184-
if (supportsServiceProtocol) {
185-
if (details) {
186-
printHelpDetails();
187-
}
188-
}
189-
CommandHelp.h.print();
190-
if (_didAttach) {
191-
CommandHelp.d.print();
192-
}
193-
CommandHelp.q.print();
182+
bool haveDetails = false;
183+
bool haveAnything = false;
194184
for (final FlutterDevice device in flutterDevices) {
195185
final String dname = device.device.name;
196186
if (device.vmService != null) {
197187
globals.printStatus('An Observatory debugger and profiler on $dname is '
198-
'available at: ${device.vmService.httpAddress}');
188+
'available at: ${device.vmService .httpAddress}');
199189
}
200190
}
191+
if (supportsServiceProtocol) {
192+
haveDetails = true;
193+
if (details) {
194+
printHelpDetails();
195+
haveAnything = true;
196+
}
197+
}
198+
final String quitMessage = _didAttach
199+
? 'To detach, press "d"; to quit, press "q".'
200+
: 'To quit, press "q".';
201+
if (haveDetails && !details) {
202+
globals.printStatus('For a more detailed help message, press "h". $quitMessage');
203+
} else if (haveAnything) {
204+
globals.printStatus('To repeat this help message, press "h". $quitMessage');
205+
} else {
206+
globals.printStatus(quitMessage);
207+
}
201208
}
202209

203210
@override

packages/flutter_tools/lib/src/run_hot.dart

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ import 'package:json_rpc_2/error_code.dart' as rpc_error_code;
99
import 'package:json_rpc_2/json_rpc_2.dart' as rpc;
1010
import 'package:meta/meta.dart';
1111
import 'package:pool/pool.dart';
12-
import 'base/async_guard.dart';
1312

14-
import 'base/command_help.dart';
13+
import 'base/async_guard.dart';
1514
import 'base/context.dart';
1615
import 'base/file_system.dart';
1716
import 'base/logger.dart';
17+
import 'base/terminal.dart';
1818
import 'base/utils.dart';
1919
import 'build_info.dart';
2020
import 'compile.dart';
@@ -1045,23 +1045,29 @@ class HotRunner extends ResidentRunner {
10451045

10461046
@override
10471047
void printHelp({ @required bool details }) {
1048-
globals.printStatus('Flutter run key commands.');
1049-
CommandHelp.r.print();
1048+
const String fire = '🔥';
1049+
String rawMessage = ' To hot reload changes while running, press "r". ';
10501050
if (canHotRestart) {
1051-
CommandHelp.R.print();
1052-
}
1053-
CommandHelp.h.print();
1054-
if (_didAttach) {
1055-
CommandHelp.d.print();
1056-
}
1057-
CommandHelp.q.print();
1058-
if (details) {
1059-
printHelpDetails();
1051+
rawMessage += 'To hot restart (and rebuild state), press "R".';
10601052
}
1053+
final String message = globals.terminal.color(
1054+
fire + globals.terminal.bolden(rawMessage),
1055+
TerminalColor.red,
1056+
);
1057+
globals.printStatus(message);
10611058
for (final FlutterDevice device in flutterDevices) {
10621059
final String dname = device.device.name;
10631060
globals.printStatus('An Observatory debugger and profiler on $dname is '
1064-
'available at:\n${device.vmService.httpAddress}');
1061+
'available at: ${device.vmService.httpAddress}');
1062+
}
1063+
final String quitMessage = _didAttach
1064+
? 'To detach, press "d"; to quit, press "q".'
1065+
: 'To quit, press "q".';
1066+
if (details) {
1067+
printHelpDetails();
1068+
globals.printStatus('To repeat this help message, press "h". $quitMessage');
1069+
} else {
1070+
globals.printStatus('For a more detailed help message, press "h". $quitMessage');
10651071
}
10661072
}
10671073

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

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -165,10 +165,7 @@ void main() {
165165
if (message == '[stdout] Lost connection to device.') {
166166
observatoryLogs.add(message);
167167
}
168-
if (message.contains('Hot reload.')) {
169-
observatoryLogs.add(message);
170-
}
171-
if (message.contains('Hot restart.')) {
168+
if (message.contains('To hot reload changes while running, press "r". To hot restart (and rebuild state), press "R".')) {
172169
observatoryLogs.add(message);
173170
}
174171
});
@@ -206,16 +203,14 @@ void main() {
206203
}));
207204
});
208205

209-
expect(observatoryLogs.length, 9);
206+
expect(observatoryLogs.length, 7);
210207
expect(observatoryLogs[0], '[stdout] Waiting for a connection from Flutter on MockAndroidDevice...');
211208
expect(observatoryLogs[1], '[verbose] Observatory URL on device: http://127.0.0.1:1234');
212209
expect(observatoryLogs[2], '[stdout] Lost connection to device.');
213-
expect(observatoryLogs[3].contains('Hot reload.'), isTrue);
214-
expect(observatoryLogs[4].contains('Hot restart.'), isTrue);
215-
expect(observatoryLogs[5], '[verbose] Observatory URL on device: http://127.0.0.1:1235');
216-
expect(observatoryLogs[6], '[stdout] Lost connection to device.');
217-
expect(observatoryLogs[7].contains('Hot reload.'), isTrue);
218-
expect(observatoryLogs[8].contains('Hot restart.'), isTrue);
210+
expect(observatoryLogs[3].contains('To hot reload changes while running, press "r". To hot restart (and rebuild state), press "R"'), isTrue);
211+
expect(observatoryLogs[4], '[verbose] Observatory URL on device: http://127.0.0.1:1235');
212+
expect(observatoryLogs[5], '[stdout] Lost connection to device.');
213+
expect(observatoryLogs[6].contains('To hot reload changes while running, press "r". To hot restart (and rebuild state), press "R"'), isTrue);
219214

220215
verify(portForwarder.forward(1234, hostPort: anyNamed('hostPort'))).called(1);
221216
verify(portForwarder.forward(1235, hostPort: anyNamed('hostPort'))).called(1);

0 commit comments

Comments
 (0)