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
bec63a54
Unverified
Commit
bec63a54
authored
Apr 17, 2020
by
Zachary Anderson
Committed by
GitHub
Apr 17, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] Provide global options with subcommand help text (#54884)
parent
6c70a8fe
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
2 deletions
+24
-2
flutter_command.dart
packages/flutter_tools/lib/src/runner/flutter_command.dart
+17
-0
flutter_command_test.dart
...tools/test/general.shard/runner/flutter_command_test.dart
+7
-2
No files found.
packages/flutter_tools/lib/src/runner/flutter_command.dart
View file @
bec63a54
...
...
@@ -848,6 +848,23 @@ abstract class FlutterCommand extends Command<void> {
}
}
@override
String
get
usage
{
final
String
usageWithoutDescription
=
super
.
usage
.
substring
(
// The description plus two newlines.
description
.
length
+
2
,
);
final
String
help
=
<
String
>[
description
,
''
,
'Global options:'
,
runner
.
argParser
.
usage
,
''
,
usageWithoutDescription
,
].
join
(
'
\n
'
);
return
help
;
}
ApplicationPackageStore
applicationPackages
;
/// Gets the parsed command-line option named [name] as `bool`.
...
...
packages/flutter_tools/test/general.shard/runner/flutter_command_test.dart
View file @
bec63a54
...
...
@@ -42,6 +42,12 @@ void main() {
when
(
mockProcessInfo
.
maxRss
).
thenReturn
(
10
);
});
testUsingContext
(
'help text contains global options'
,
()
{
final
FakeCommand
fake
=
FakeCommand
();
createTestCommandRunner
(
fake
);
expect
(
fake
.
usage
,
contains
(
'Global options:
\n
'
));
});
testUsingContext
(
'honors shouldUpdateCache false'
,
()
async
{
final
DummyFlutterCommand
flutterCommand
=
DummyFlutterCommand
(
shouldUpdateCache:
false
);
await
flutterCommand
.
run
();
...
...
@@ -423,10 +429,9 @@ void main() {
});
}
class
FakeCommand
extends
FlutterCommand
{
@override
String
get
description
=>
null
;
String
get
description
=>
'A fake command'
;
@override
String
get
name
=>
'fake'
;
...
...
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