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';
...
@@ -9,7 +9,6 @@ import 'platform.dart';
import
'terminal.dart'
;
import
'terminal.dart'
;
const
String
fire
=
'🔥'
;
const
String
fire
=
'🔥'
;
const
String
image
=
'🖼️'
;
const
int
maxLineWidth
=
84
;
const
int
maxLineWidth
=
84
;
/// Encapsulates the help text construction and printing.
/// Encapsulates the help text construction and printing.
...
@@ -32,9 +31,13 @@ class CommandHelp {
...
@@ -32,9 +31,13 @@ class CommandHelp {
final
OutputPreferences
_outputPreferences
;
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
(
late
final
CommandHelpOption
I
=
_makeOption
(
'I'
,
'I'
,
'Toggle oversized image inversion
$image
.'
,
'Toggle oversized image inversion.'
,
'debugInvertOversizedImages'
,
'debugInvertOversizedImages'
,
);
);
...
@@ -44,6 +47,11 @@ class CommandHelp {
...
@@ -44,6 +47,11 @@ class CommandHelp {
'debugDumpLayerTree'
,
'debugDumpLayerTree'
,
);
);
late
final
CommandHelpOption
M
=
_makeOption
(
'M'
,
'Write SkSL shaders to a unique file in the project directory.'
,
);
late
final
CommandHelpOption
P
=
_makeOption
(
late
final
CommandHelpOption
P
=
_makeOption
(
'P'
,
'P'
,
'Toggle performance overlay.'
,
'Toggle performance overlay.'
,
...
@@ -75,7 +83,7 @@ class CommandHelp {
...
@@ -75,7 +83,7 @@ class CommandHelp {
late
final
CommandHelpOption
b
=
_makeOption
(
late
final
CommandHelpOption
b
=
_makeOption
(
'b'
,
'b'
,
'Toggle
the platform brightness setting
(dark and light mode).'
,
'Toggle
platform brightness
(dark and light mode).'
,
'debugBrightnessOverride'
,
'debugBrightnessOverride'
,
);
);
...
@@ -94,17 +102,27 @@ class CommandHelp {
...
@@ -94,17 +102,27 @@ class CommandHelp {
'Run source code generators.'
'Run source code generators.'
);
);
late
final
CommandHelpOption
h
=
_makeOption
(
late
final
CommandHelpOption
h
WithDetails
=
_makeOption
(
'h'
,
'h'
,
'Repeat this help message.'
,
'Repeat this help message.'
,
);
);
late
final
CommandHelpOption
hWithoutDetails
=
_makeOption
(
'h'
,
'List all available interactive commands.'
,
);
late
final
CommandHelpOption
i
=
_makeOption
(
late
final
CommandHelpOption
i
=
_makeOption
(
'i'
,
'i'
,
'Toggle widget inspector.'
,
'Toggle widget inspector.'
,
'WidgetsApp.showWidgetInspectorOverride'
,
'WidgetsApp.showWidgetInspectorOverride'
,
);
);
late
final
CommandHelpOption
k
=
_makeOption
(
'k'
,
'Toggle CanvasKit rendering.'
,
);
late
final
CommandHelpOption
o
=
_makeOption
(
late
final
CommandHelpOption
o
=
_makeOption
(
'o'
,
'o'
,
'Simulate different operating systems.'
,
'Simulate different operating systems.'
,
...
@@ -147,17 +165,11 @@ class CommandHelp {
...
@@ -147,17 +165,11 @@ class CommandHelp {
late
final
CommandHelpOption
z
=
_makeOption
(
late
final
CommandHelpOption
z
=
_makeOption
(
'z'
,
'z'
,
'Toggle elevation checker.'
,
'Toggle elevation checker.'
,
'debugCheckElevationsEnabled'
,
);
);
late
final
CommandHelpOption
k
=
_makeOption
(
// When updating the list above, see the notes above the list regarding order
'k'
,
// and tests.
'Toggle CanvasKit rendering.'
,
);
late
final
CommandHelpOption
M
=
_makeOption
(
'M'
,
'Write SkSL shaders to a unique file in the project directory.'
,
);
CommandHelpOption
_makeOption
(
String
key
,
String
description
,
[
CommandHelpOption
_makeOption
(
String
key
,
String
description
,
[
String
inParenthesis
=
''
,
String
inParenthesis
=
''
,
...
...
packages/flutter_tools/lib/src/resident_runner.dart
View file @
598737ad
...
@@ -1449,7 +1449,6 @@ abstract class ResidentRunner extends ResidentHandlers {
...
@@ -1449,7 +1449,6 @@ abstract class ResidentRunner extends ResidentHandlers {
commandHelp
.
s
.
print
();
commandHelp
.
s
.
print
();
}
}
if
(
supportsServiceProtocol
)
{
if
(
supportsServiceProtocol
)
{
commandHelp
.
b
.
print
();
commandHelp
.
w
.
print
();
commandHelp
.
w
.
print
();
commandHelp
.
t
.
print
();
commandHelp
.
t
.
print
();
if
(
isRunningDebug
)
{
if
(
isRunningDebug
)
{
...
@@ -1457,21 +1456,24 @@ abstract class ResidentRunner extends ResidentHandlers {
...
@@ -1457,21 +1456,24 @@ abstract class ResidentRunner extends ResidentHandlers {
commandHelp
.
S
.
print
();
commandHelp
.
S
.
print
();
commandHelp
.
U
.
print
();
commandHelp
.
U
.
print
();
commandHelp
.
i
.
print
();
commandHelp
.
i
.
print
();
commandHelp
.
I
.
print
();
commandHelp
.
p
.
print
();
commandHelp
.
p
.
print
();
commandHelp
.
I
.
print
();
commandHelp
.
o
.
print
();
commandHelp
.
o
.
print
();
commandHelp
.
b
.
print
();
commandHelp
.
z
.
print
();
commandHelp
.
z
.
print
();
commandHelp
.
g
.
print
();
}
else
{
}
else
{
commandHelp
.
S
.
print
();
commandHelp
.
S
.
print
();
commandHelp
.
U
.
print
();
commandHelp
.
U
.
print
();
}
}
// Performance related features: `P` should precede `a`, which should precede `M`.
commandHelp
.
P
.
print
();
commandHelp
.
a
.
print
();
if
(
supportsWriteSkSL
)
{
if
(
supportsWriteSkSL
)
{
commandHelp
.
M
.
print
();
commandHelp
.
M
.
print
();
}
}
// `P` should precede `a`
if
(
isRunningDebug
)
{
commandHelp
.
P
.
print
();
commandHelp
.
g
.
print
();
commandHelp
.
a
.
print
();
}
}
}
}
}
...
...
packages/flutter_tools/lib/src/run_cold.dart
View file @
598737ad
...
@@ -213,8 +213,10 @@ class ColdRunner extends ResidentRunner {
...
@@ -213,8 +213,10 @@ class ColdRunner extends ResidentRunner {
globals
.
printStatus
(
'Flutter run key commands.'
);
globals
.
printStatus
(
'Flutter run key commands.'
);
if
(
details
)
{
if
(
details
)
{
printHelpDetails
();
printHelpDetails
();
commandHelp
.
hWithDetails
.
print
();
}
else
{
commandHelp
.
hWithoutDetails
.
print
();
}
}
commandHelp
.
h
.
print
();
// TODO(ianh): print different message if details is false
if
(
_didAttach
)
{
if
(
_didAttach
)
{
commandHelp
.
d
.
print
();
commandHelp
.
d
.
print
();
}
}
...
...
packages/flutter_tools/lib/src/run_hot.dart
View file @
598737ad
...
@@ -1081,7 +1081,6 @@ class HotRunner extends ResidentRunner {
...
@@ -1081,7 +1081,6 @@ class HotRunner extends ResidentRunner {
return
message
.
toString
();
return
message
.
toString
();
}
}
@override
@override
void
printHelp
({
@required
bool
details
})
{
void
printHelp
({
@required
bool
details
})
{
globals
.
printStatus
(
'Flutter run key commands.'
);
globals
.
printStatus
(
'Flutter run key commands.'
);
...
@@ -1089,15 +1088,17 @@ class HotRunner extends ResidentRunner {
...
@@ -1089,15 +1088,17 @@ class HotRunner extends ResidentRunner {
if
(
supportsRestart
)
{
if
(
supportsRestart
)
{
commandHelp
.
R
.
print
();
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
)
{
if
(
_didAttach
)
{
commandHelp
.
d
.
print
();
commandHelp
.
d
.
print
();
}
}
commandHelp
.
c
.
print
();
commandHelp
.
c
.
print
();
commandHelp
.
q
.
print
();
commandHelp
.
q
.
print
();
if
(
details
)
{
printHelpDetails
();
}
globals
.
printStatus
(
''
);
globals
.
printStatus
(
''
);
if
(
debuggingOptions
.
buildInfo
.
nullSafetyMode
==
NullSafetyMode
.
sound
)
{
if
(
debuggingOptions
.
buildInfo
.
nullSafetyMode
==
NullSafetyMode
.
sound
)
{
globals
.
printStatus
(
'💪 Running with sound null safety 💪'
,
emphasis:
true
);
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() {
...
@@ -1465,7 +1465,7 @@ void main() {
expect
(
testLogger
.
statusText
,
isEmpty
);
expect
(
testLogger
.
statusText
,
isEmpty
);
}));
}));
testUsingContext
(
'ResidentRunner printHelpDetails'
,
()
=>
testbed
.
run
(()
{
testUsingContext
(
'ResidentRunner printHelpDetails
hot runner
'
,
()
=>
testbed
.
run
(()
{
fakeVmServiceHost
=
FakeVmServiceHost
(
requests:
<
VmServiceExpectation
>[]);
fakeVmServiceHost
=
FakeVmServiceHost
(
requests:
<
VmServiceExpectation
>[]);
residentRunner
.
printHelp
(
details:
true
);
residentRunner
.
printHelp
(
details:
true
);
...
@@ -1484,25 +1484,56 @@ void main() {
...
@@ -1484,25 +1484,56 @@ void main() {
'Flutter run key commands.'
,
'Flutter run key commands.'
,
commandHelp
.
r
,
commandHelp
.
r
,
commandHelp
.
R
,
commandHelp
.
R
,
commandHelp
.
h
,
commandHelp
.
c
,
commandHelp
.
q
,
commandHelp
.
s
,
commandHelp
.
s
,
commandHelp
.
b
,
commandHelp
.
w
,
commandHelp
.
w
,
commandHelp
.
t
,
commandHelp
.
t
,
commandHelp
.
L
,
commandHelp
.
L
,
commandHelp
.
S
,
commandHelp
.
S
,
commandHelp
.
U
,
commandHelp
.
U
,
commandHelp
.
i
,
commandHelp
.
i
,
commandHelp
.
I
,
commandHelp
.
p
,
commandHelp
.
p
,
commandHelp
.
I
,
commandHelp
.
o
,
commandHelp
.
o
,
commandHelp
.
b
,
commandHelp
.
z
,
commandHelp
.
z
,
commandHelp
.
g
,
commandHelp
.
M
,
commandHelp
.
P
,
commandHelp
.
P
,
commandHelp
.
a
,
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 💪'
,
'💪 Running with sound null safety 💪'
,
''
,
''
,
...
@@ -1538,7 +1569,40 @@ void main() {
...
@@ -1538,7 +1569,40 @@ void main() {
<
dynamic
>[
<
dynamic
>[
'Flutter run key commands.'
,
'Flutter run key commands.'
,
commandHelp
.
s
,
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
.
c
,
commandHelp
.
q
,
commandHelp
.
q
,
''
''
...
...
packages/flutter_tools/test/integration.shard/overall_experience_test.dart
View file @
598737ad
...
@@ -542,7 +542,7 @@ void main() {
...
@@ -542,7 +542,7 @@ void main() {
'Flutter run key commands.'
,
'Flutter run key commands.'
,
startsWith
(
'r Hot reload.'
),
startsWith
(
'r Hot reload.'
),
'R Hot restart.'
,
'R Hot restart.'
,
'h
Repeat this help message
.'
,
'h
List all available interactive commands
.'
,
'd Detach (terminate "flutter run" but leave application running).'
,
'd Detach (terminate "flutter run" but leave application running).'
,
'c Clear the screen'
,
'c Clear the screen'
,
'q Quit (terminate the application on the device).'
,
'q Quit (terminate the application on the device).'
,
...
@@ -555,25 +555,25 @@ void main() {
...
@@ -555,25 +555,25 @@ void main() {
'Flutter run key commands.'
,
'Flutter run key commands.'
,
startsWith
(
'r Hot reload.'
),
startsWith
(
'r Hot reload.'
),
'R Hot restart.'
,
'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)'
,
'w Dump widget hierarchy to the console. (debugDumpApp)'
,
't Dump rendering tree to the console. (debugDumpRenderTree)'
,
't Dump rendering tree to the console. (debugDumpRenderTree)'
,
'L Dump layer tree to the console. (debugDumpLayerTree)'
,
'L Dump layer tree to the console. (debugDumpLayerTree)'
,
'S Dump accessibility tree in traversal order. (debugDumpSemantics)'
,
'S Dump accessibility tree in traversal order. (debugDumpSemantics)'
,
'U Dump accessibility tree in inverse hit test order. (debugDumpSemantics)'
,
'U Dump accessibility tree in inverse hit test order. (debugDumpSemantics)'
,
'i Toggle widget inspector. (WidgetsApp.showWidgetInspectorOverride)'
,
'i Toggle widget inspector. (WidgetsApp.showWidgetInspectorOverride)'
,
startsWith
(
'I Toggle oversized image inversion'
),
'p Toggle the display of construction lines. (debugPaintSizeEnabled)'
,
'p Toggle the display of construction lines. (debugPaintSizeEnabled)'
,
'I Toggle oversized image inversion. (debugInvertOversizedImages)'
,
'o Simulate different operating systems. (defaultTargetPlatform)'
,
'o Simulate different operating systems. (defaultTargetPlatform)'
,
'z Toggle elevation checker.'
,
'b Toggle platform brightness (dark and light mode). (debugBrightnessOverride)'
,
'g Run source code generators.'
,
'z Toggle elevation checker. (debugCheckElevationsEnabled)'
,
'M Write SkSL shaders to a unique file in the project directory.'
,
'P Toggle performance overlay. (WidgetsApp.showPerformanceOverlay)'
,
'P Toggle performance overlay. (WidgetsApp.showPerformanceOverlay)'
,
'a Toggle timeline events for all widget build methods. (debugProfileWidgetBuilds)'
,
'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'
),
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