Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
598737ad
Unverified
Commit
598737ad
authored
Apr 23, 2021
by
Ian Hickson
Committed by
GitHub
Apr 23, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean up the command line tool interactive help output. (#80903)
parent
b30d97a6
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
176 additions
and
75 deletions
+176
-75
command_help.dart
packages/flutter_tools/lib/src/base/command_help.dart
+25
-13
resident_runner.dart
packages/flutter_tools/lib/src/resident_runner.dart
+8
-6
run_cold.dart
packages/flutter_tools/lib/src/run_cold.dart
+3
-1
run_hot.dart
packages/flutter_tools/lib/src/run_hot.dart
+6
-5
command_help_test.dart
...tter_tools/test/general.shard/base/command_help_test.dart
+51
-31
resident_runner_test.dart
...lutter_tools/test/general.shard/resident_runner_test.dart
+73
-9
overall_experience_test.dart
...tools/test/integration.shard/overall_experience_test.dart
+10
-10
No files found.
packages/flutter_tools/lib/src/base/command_help.dart
View file @
598737ad
...
...
@@ -9,7 +9,6 @@ import 'platform.dart';
import
'terminal.dart'
;
const
String
fire
=
'🔥'
;
const
String
image
=
'🖼️'
;
const
int
maxLineWidth
=
84
;
/// Encapsulates the help text construction and printing.
...
...
@@ -32,9 +31,13 @@ class CommandHelp {
final
OutputPreferences
_outputPreferences
;
// COMMANDS IN ALPHABETICAL ORDER.
// Uppercase first, then lowercase.
// When updating this, update all the tests in command_help_test.dart accordingly.
late
final
CommandHelpOption
I
=
_makeOption
(
'I'
,
'Toggle oversized image inversion
$image
.'
,
'Toggle oversized image inversion.'
,
'debugInvertOversizedImages'
,
);
...
...
@@ -44,6 +47,11 @@ class CommandHelp {
'debugDumpLayerTree'
,
);
late
final
CommandHelpOption
M
=
_makeOption
(
'M'
,
'Write SkSL shaders to a unique file in the project directory.'
,
);
late
final
CommandHelpOption
P
=
_makeOption
(
'P'
,
'Toggle performance overlay.'
,
...
...
@@ -75,7 +83,7 @@ class CommandHelp {
late
final
CommandHelpOption
b
=
_makeOption
(
'b'
,
'Toggle
the platform brightness setting
(dark and light mode).'
,
'Toggle
platform brightness
(dark and light mode).'
,
'debugBrightnessOverride'
,
);
...
...
@@ -94,17 +102,27 @@ class CommandHelp {
'Run source code generators.'
);
late
final
CommandHelpOption
h
=
_makeOption
(
late
final
CommandHelpOption
h
WithDetails
=
_makeOption
(
'h'
,
'Repeat this help message.'
,
);
late
final
CommandHelpOption
hWithoutDetails
=
_makeOption
(
'h'
,
'List all available interactive commands.'
,
);
late
final
CommandHelpOption
i
=
_makeOption
(
'i'
,
'Toggle widget inspector.'
,
'WidgetsApp.showWidgetInspectorOverride'
,
);
late
final
CommandHelpOption
k
=
_makeOption
(
'k'
,
'Toggle CanvasKit rendering.'
,
);
late
final
CommandHelpOption
o
=
_makeOption
(
'o'
,
'Simulate different operating systems.'
,
...
...
@@ -147,17 +165,11 @@ class CommandHelp {
late
final
CommandHelpOption
z
=
_makeOption
(
'z'
,
'Toggle elevation checker.'
,
'debugCheckElevationsEnabled'
,
);
late
final
CommandHelpOption
k
=
_makeOption
(
'k'
,
'Toggle CanvasKit rendering.'
,
);
late
final
CommandHelpOption
M
=
_makeOption
(
'M'
,
'Write SkSL shaders to a unique file in the project directory.'
,
);
// When updating the list above, see the notes above the list regarding order
// and tests.
CommandHelpOption
_makeOption
(
String
key
,
String
description
,
[
String
inParenthesis
=
''
,
...
...
packages/flutter_tools/lib/src/resident_runner.dart
View file @
598737ad
...
...
@@ -1449,7 +1449,6 @@ abstract class ResidentRunner extends ResidentHandlers {
commandHelp
.
s
.
print
();
}
if
(
supportsServiceProtocol
)
{
commandHelp
.
b
.
print
();
commandHelp
.
w
.
print
();
commandHelp
.
t
.
print
();
if
(
isRunningDebug
)
{
...
...
@@ -1457,21 +1456,24 @@ abstract class ResidentRunner extends ResidentHandlers {
commandHelp
.
S
.
print
();
commandHelp
.
U
.
print
();
commandHelp
.
i
.
print
();
commandHelp
.
I
.
print
();
commandHelp
.
p
.
print
();
commandHelp
.
I
.
print
();
commandHelp
.
o
.
print
();
commandHelp
.
b
.
print
();
commandHelp
.
z
.
print
();
commandHelp
.
g
.
print
();
}
else
{
commandHelp
.
S
.
print
();
commandHelp
.
U
.
print
();
}
// Performance related features: `P` should precede `a`, which should precede `M`.
commandHelp
.
P
.
print
();
commandHelp
.
a
.
print
();
if
(
supportsWriteSkSL
)
{
commandHelp
.
M
.
print
();
}
// `P` should precede `a`
commandHelp
.
P
.
print
();
commandHelp
.
a
.
print
();
if
(
isRunningDebug
)
{
commandHelp
.
g
.
print
();
}
}
}
...
...
packages/flutter_tools/lib/src/run_cold.dart
View file @
598737ad
...
...
@@ -213,8 +213,10 @@ class ColdRunner extends ResidentRunner {
globals
.
printStatus
(
'Flutter run key commands.'
);
if
(
details
)
{
printHelpDetails
();
commandHelp
.
hWithDetails
.
print
();
}
else
{
commandHelp
.
hWithoutDetails
.
print
();
}
commandHelp
.
h
.
print
();
// TODO(ianh): print different message if details is false
if
(
_didAttach
)
{
commandHelp
.
d
.
print
();
}
...
...
packages/flutter_tools/lib/src/run_hot.dart
View file @
598737ad
...
...
@@ -1081,7 +1081,6 @@ class HotRunner extends ResidentRunner {
return
message
.
toString
();
}
@override
void
printHelp
({
@required
bool
details
})
{
globals
.
printStatus
(
'Flutter run key commands.'
);
...
...
@@ -1089,15 +1088,17 @@ class HotRunner extends ResidentRunner {
if
(
supportsRestart
)
{
commandHelp
.
R
.
print
();
}
commandHelp
.
h
.
print
();
// TODO(ianh): print different message if "details" is false
if
(
details
)
{
printHelpDetails
();
commandHelp
.
hWithDetails
.
print
();
}
else
{
commandHelp
.
hWithoutDetails
.
print
();
}
if
(
_didAttach
)
{
commandHelp
.
d
.
print
();
}
commandHelp
.
c
.
print
();
commandHelp
.
q
.
print
();
if
(
details
)
{
printHelpDetails
();
}
globals
.
printStatus
(
''
);
if
(
debuggingOptions
.
buildInfo
.
nullSafetyMode
==
NullSafetyMode
.
sound
)
{
globals
.
printStatus
(
'💪 Running with sound null safety 💪'
,
emphasis:
true
);
...
...
packages/flutter_tools/test/general.shard/base/command_help_test.dart
View file @
598737ad
This diff is collapsed.
Click to expand it.
packages/flutter_tools/test/general.shard/resident_runner_test.dart
View file @
598737ad
...
...
@@ -1465,7 +1465,7 @@ void main() {
expect
(
testLogger
.
statusText
,
isEmpty
);
}));
testUsingContext
(
'ResidentRunner printHelpDetails'
,
()
=>
testbed
.
run
(()
{
testUsingContext
(
'ResidentRunner printHelpDetails
hot runner
'
,
()
=>
testbed
.
run
(()
{
fakeVmServiceHost
=
FakeVmServiceHost
(
requests:
<
VmServiceExpectation
>[]);
residentRunner
.
printHelp
(
details:
true
);
...
...
@@ -1484,25 +1484,56 @@ void main() {
'Flutter run key commands.'
,
commandHelp
.
r
,
commandHelp
.
R
,
commandHelp
.
h
,
commandHelp
.
c
,
commandHelp
.
q
,
commandHelp
.
s
,
commandHelp
.
b
,
commandHelp
.
w
,
commandHelp
.
t
,
commandHelp
.
L
,
commandHelp
.
S
,
commandHelp
.
U
,
commandHelp
.
i
,
commandHelp
.
I
,
commandHelp
.
p
,
commandHelp
.
I
,
commandHelp
.
o
,
commandHelp
.
b
,
commandHelp
.
z
,
commandHelp
.
g
,
commandHelp
.
M
,
commandHelp
.
P
,
commandHelp
.
a
,
commandHelp
.
M
,
commandHelp
.
g
,
commandHelp
.
hWithDetails
,
commandHelp
.
c
,
commandHelp
.
q
,
''
,
'💪 Running with sound null safety 💪'
,
''
,
'An Observatory debugger and profiler on FakeDevice is available at: null'
,
''
,
].
join
(
'
\n
'
)
));
}));
testUsingContext
(
'ResidentRunner printHelp hot runner'
,
()
=>
testbed
.
run
(()
{
fakeVmServiceHost
=
FakeVmServiceHost
(
requests:
<
VmServiceExpectation
>[]);
residentRunner
.
printHelp
(
details:
false
);
final
CommandHelp
commandHelp
=
residentRunner
.
commandHelp
;
// supports service protocol
expect
(
residentRunner
.
supportsServiceProtocol
,
true
);
// isRunningDebug
expect
(
residentRunner
.
isRunningDebug
,
true
);
// does support SkSL
expect
(
residentRunner
.
supportsWriteSkSL
,
true
);
// commands
expect
(
testLogger
.
statusText
,
equals
(
<
dynamic
>[
'Flutter run key commands.'
,
commandHelp
.
r
,
commandHelp
.
R
,
commandHelp
.
hWithoutDetails
,
commandHelp
.
c
,
commandHelp
.
q
,
''
,
'💪 Running with sound null safety 💪'
,
''
,
...
...
@@ -1538,7 +1569,40 @@ void main() {
<
dynamic
>[
'Flutter run key commands.'
,
commandHelp
.
s
,
commandHelp
.
h
,
commandHelp
.
hWithDetails
,
commandHelp
.
c
,
commandHelp
.
q
,
''
].
join
(
'
\n
'
)
));
}));
testUsingContext
(
'ResidentRunner printHelp cold runner'
,
()
=>
testbed
.
run
(()
{
fakeVmServiceHost
=
null
;
residentRunner
=
ColdRunner
(
<
FlutterDevice
>[
mockFlutterDevice
,
],
stayResident:
false
,
debuggingOptions:
DebuggingOptions
.
disabled
(
BuildInfo
.
release
),
target:
'main.dart'
,
devtoolsHandler:
createNoOpHandler
,
);
residentRunner
.
printHelp
(
details:
false
);
final
CommandHelp
commandHelp
=
residentRunner
.
commandHelp
;
// does not supports service protocol
expect
(
residentRunner
.
supportsServiceProtocol
,
false
);
// isRunningDebug
expect
(
residentRunner
.
isRunningDebug
,
false
);
// does support SkSL
expect
(
residentRunner
.
supportsWriteSkSL
,
false
);
// commands
expect
(
testLogger
.
statusText
,
equals
(
<
dynamic
>[
'Flutter run key commands.'
,
commandHelp
.
hWithoutDetails
,
commandHelp
.
c
,
commandHelp
.
q
,
''
...
...
packages/flutter_tools/test/integration.shard/overall_experience_test.dart
View file @
598737ad
...
...
@@ -542,7 +542,7 @@ void main() {
'Flutter run key commands.'
,
startsWith
(
'r Hot reload.'
),
'R Hot restart.'
,
'h
Repeat this help message
.'
,
'h
List all available interactive commands
.'
,
'd Detach (terminate "flutter run" but leave application running).'
,
'c Clear the screen'
,
'q Quit (terminate the application on the device).'
,
...
...
@@ -555,25 +555,25 @@ void main() {
'Flutter run key commands.'
,
startsWith
(
'r Hot reload.'
),
'R Hot restart.'
,
'h Repeat this help message.'
,
'd Detach (terminate "flutter run" but leave application running).'
,
'c Clear the screen'
,
'q Quit (terminate the application on the device).'
,
'b Toggle the platform brightness setting (dark and light mode). (debugBrightnessOverride)'
,
'w Dump widget hierarchy to the console. (debugDumpApp)'
,
't Dump rendering tree to the console. (debugDumpRenderTree)'
,
'L Dump layer tree to the console. (debugDumpLayerTree)'
,
'S Dump accessibility tree in traversal order. (debugDumpSemantics)'
,
'U Dump accessibility tree in inverse hit test order. (debugDumpSemantics)'
,
'i Toggle widget inspector. (WidgetsApp.showWidgetInspectorOverride)'
,
startsWith
(
'I Toggle oversized image inversion'
),
'p Toggle the display of construction lines. (debugPaintSizeEnabled)'
,
'I Toggle oversized image inversion. (debugInvertOversizedImages)'
,
'o Simulate different operating systems. (defaultTargetPlatform)'
,
'z Toggle elevation checker.'
,
'g Run source code generators.'
,
'M Write SkSL shaders to a unique file in the project directory.'
,
'b Toggle platform brightness (dark and light mode). (debugBrightnessOverride)'
,
'z Toggle elevation checker. (debugCheckElevationsEnabled)'
,
'P Toggle performance overlay. (WidgetsApp.showPerformanceOverlay)'
,
'a Toggle timeline events for all widget build methods. (debugProfileWidgetBuilds)'
,
'M Write SkSL shaders to a unique file in the project directory.'
,
'g Run source code generators.'
,
'h Repeat this help message.'
,
'd Detach (terminate "flutter run" but leave application running).'
,
'c Clear the screen'
,
'q Quit (terminate the application on the device).'
,
''
,
contains
(
'Running with sound null safety'
),
''
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment