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
3e43c3e1
Unverified
Commit
3e43c3e1
authored
Oct 06, 2021
by
Pierre-Louis
Committed by
GitHub
Oct 06, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Categorize flutter tool commands (#87747)
parent
0a626945
Changes
29
Hide whitespace changes
Inline
Side-by-side
Showing
29 changed files
with
102 additions
and
1 deletion
+102
-1
analyze.dart
packages/flutter_tools/lib/src/commands/analyze.dart
+3
-0
assemble.dart
packages/flutter_tools/lib/src/commands/assemble.dart
+3
-0
attach.dart
packages/flutter_tools/lib/src/commands/attach.dart
+3
-0
build.dart
packages/flutter_tools/lib/src/commands/build.dart
+3
-0
channel.dart
packages/flutter_tools/lib/src/commands/channel.dart
+3
-0
clean.dart
packages/flutter_tools/lib/src/commands/clean.dart
+3
-0
config.dart
packages/flutter_tools/lib/src/commands/config.dart
+3
-0
create.dart
packages/flutter_tools/lib/src/commands/create.dart
+3
-0
custom_devices.dart
packages/flutter_tools/lib/src/commands/custom_devices.dart
+3
-0
daemon.dart
packages/flutter_tools/lib/src/commands/daemon.dart
+3
-0
devices.dart
packages/flutter_tools/lib/src/commands/devices.dart
+3
-0
doctor.dart
packages/flutter_tools/lib/src/commands/doctor.dart
+3
-0
downgrade.dart
packages/flutter_tools/lib/src/commands/downgrade.dart
+3
-0
drive.dart
packages/flutter_tools/lib/src/commands/drive.dart
+4
-1
emulators.dart
packages/flutter_tools/lib/src/commands/emulators.dart
+3
-0
format.dart
packages/flutter_tools/lib/src/commands/format.dart
+3
-0
generate_localizations.dart
...lutter_tools/lib/src/commands/generate_localizations.dart
+3
-0
install.dart
packages/flutter_tools/lib/src/commands/install.dart
+3
-0
logs.dart
packages/flutter_tools/lib/src/commands/logs.dart
+3
-0
packages.dart
packages/flutter_tools/lib/src/commands/packages.dart
+3
-0
precache.dart
packages/flutter_tools/lib/src/commands/precache.dart
+3
-0
run.dart
packages/flutter_tools/lib/src/commands/run.dart
+3
-0
screenshot.dart
packages/flutter_tools/lib/src/commands/screenshot.dart
+3
-0
shell_completion.dart
...ages/flutter_tools/lib/src/commands/shell_completion.dart
+3
-0
symbolize.dart
packages/flutter_tools/lib/src/commands/symbolize.dart
+3
-0
test.dart
packages/flutter_tools/lib/src/commands/test.dart
+3
-0
upgrade.dart
packages/flutter_tools/lib/src/commands/upgrade.dart
+3
-0
flutter_command.dart
packages/flutter_tools/lib/src/runner/flutter_command.dart
+7
-0
args_test.dart
packages/flutter_tools/test/general.shard/args_test.dart
+13
-0
No files found.
packages/flutter_tools/lib/src/commands/analyze.dart
View file @
3e43c3e1
...
...
@@ -105,6 +105,9 @@ class AnalyzeCommand extends FlutterCommand {
@override
String
get
description
=>
"Analyze the project's Dart code."
;
@override
String
get
category
=>
FlutterCommandCategory
.
project
;
@override
bool
get
shouldRunPub
{
// If they're not analyzing the current project.
...
...
packages/flutter_tools/lib/src/commands/assemble.dart
View file @
3e43c3e1
...
...
@@ -139,6 +139,9 @@ class AssembleCommand extends FlutterCommand {
@override
String
get
name
=>
'assemble'
;
@override
String
get
category
=>
FlutterCommandCategory
.
project
;
@override
Future
<
CustomDimensions
>
get
usageValues
async
{
final
FlutterProject
flutterProject
=
FlutterProject
.
current
();
...
...
packages/flutter_tools/lib/src/commands/attach.dart
View file @
3e43c3e1
...
...
@@ -144,6 +144,9 @@ If the app or module is already running and the specific observatory port is
known, it can be explicitly provided to attach via the command-line, e.g.
`
$
flutter attach --debug-port 12345`'''
;
@override
final
String
category
=
FlutterCommandCategory
.
tools
;
int
get
debugPort
{
if
(
argResults
[
'debug-port'
]
==
null
)
{
return
null
;
...
...
packages/flutter_tools/lib/src/commands/build.dart
View file @
3e43c3e1
...
...
@@ -57,6 +57,9 @@ class BuildCommand extends FlutterCommand {
@override
final
String
description
=
'Build an executable app or install bundle.'
;
@override
String
get
category
=>
FlutterCommandCategory
.
project
;
@override
Future
<
FlutterCommandResult
>
runCommand
()
async
=>
null
;
}
...
...
packages/flutter_tools/lib/src/commands/channel.dart
View file @
3e43c3e1
...
...
@@ -27,6 +27,9 @@ class ChannelCommand extends FlutterCommand {
@override
final
String
description
=
'List or switch Flutter channels.'
;
@override
final
String
category
=
FlutterCommandCategory
.
sdk
;
@override
String
get
invocation
=>
'
${runner.executableName}
$name
[<channel-name>]'
;
...
...
packages/flutter_tools/lib/src/commands/clean.dart
View file @
3e43c3e1
...
...
@@ -29,6 +29,9 @@ class CleanCommand extends FlutterCommand {
@override
final
String
description
=
'Delete the build/ and .dart_tool/ directories.'
;
@override
String
get
category
=>
FlutterCommandCategory
.
project
;
@override
Future
<
Set
<
DevelopmentArtifact
>>
get
requiredArtifacts
async
=>
const
<
DevelopmentArtifact
>{};
...
...
packages/flutter_tools/lib/src/commands/config.dart
View file @
3e43c3e1
...
...
@@ -54,6 +54,9 @@ class ConfigCommand extends FlutterCommand {
'The Flutter tool anonymously reports feature usage statistics and basic crash reports to help improve '
"Flutter tools over time. See Google's privacy policy: https://www.google.com/intl/en/policies/privacy/"
;
@override
final
String
category
=
FlutterCommandCategory
.
sdk
;
@override
final
List
<
String
>
aliases
=
<
String
>[
'configure'
];
...
...
packages/flutter_tools/lib/src/commands/create.dart
View file @
3e43c3e1
...
...
@@ -78,6 +78,9 @@ class CreateCommand extends CreateBase {
final
String
description
=
'Create a new Flutter project.
\n\n
'
'If run on a project that already exists, this will repair the project, recreating any files that are missing.'
;
@override
String
get
category
=>
FlutterCommandCategory
.
project
;
@override
String
get
invocation
=>
'
${runner.executableName}
$name
<output directory>'
;
...
...
packages/flutter_tools/lib/src/commands/custom_devices.dart
View file @
3e43c3e1
...
...
@@ -158,6 +158,9 @@ Requires the custom devices feature to be enabled. You can enable it using "flut
@override
String
get
name
=>
'custom-devices'
;
@override
String
get
category
=>
FlutterCommandCategory
.
tools
;
@override
Future
<
FlutterCommandResult
>
runCommand
()
async
=>
null
;
...
...
packages/flutter_tools/lib/src/commands/daemon.dart
View file @
3e43c3e1
...
...
@@ -49,6 +49,9 @@ class DaemonCommand extends FlutterCommand {
@override
final
String
description
=
'Run a persistent, JSON-RPC based server to communicate with devices.'
;
@override
final
String
category
=
FlutterCommandCategory
.
tools
;
@override
final
bool
hidden
;
...
...
packages/flutter_tools/lib/src/commands/devices.dart
View file @
3e43c3e1
...
...
@@ -33,6 +33,9 @@ class DevicesCommand extends FlutterCommand {
@override
final
String
description
=
'List all connected devices.'
;
@override
final
String
category
=
FlutterCommandCategory
.
tools
;
@override
Duration
get
deviceDiscoveryTimeout
{
if
(
argResults
[
'timeout'
]
!=
null
)
{
...
...
packages/flutter_tools/lib/src/commands/doctor.dart
View file @
3e43c3e1
...
...
@@ -31,6 +31,9 @@ class DoctorCommand extends FlutterCommand {
@override
final
String
description
=
'Show information about the installed tooling.'
;
@override
final
String
category
=
FlutterCommandCategory
.
sdk
;
@override
Future
<
FlutterCommandResult
>
runCommand
()
async
{
globals
.
flutterVersion
.
fetchTagsAndUpdate
();
...
...
packages/flutter_tools/lib/src/commands/downgrade.dart
View file @
3e43c3e1
...
...
@@ -76,6 +76,9 @@ class DowngradeCommand extends FlutterCommand {
@override
String
get
name
=>
'downgrade'
;
@override
final
String
category
=
FlutterCommandCategory
.
sdk
;
@override
Future
<
FlutterCommandResult
>
runCommand
()
async
{
// Commands do not necessarily have access to the correct zone injected
...
...
packages/flutter_tools/lib/src/commands/drive.dart
View file @
3e43c3e1
...
...
@@ -22,7 +22,7 @@ import '../device.dart';
import
'../drive/drive_service.dart'
;
import
'../globals_null_migrated.dart'
as
globals
;
import
'../resident_runner.dart'
;
import
'../runner/flutter_command.dart'
show
FlutterCommandResult
,
FlutterOptions
;
import
'../runner/flutter_command.dart'
show
FlutterCommand
Category
,
FlutterCommand
Result
,
FlutterOptions
;
import
'../web/web_device.dart'
;
import
'run.dart'
;
...
...
@@ -172,6 +172,9 @@ class DriveCommand extends RunCommandBase {
@override
final
String
description
=
'Run integration tests for the project on an attached device or emulator.'
;
@override
String
get
category
=>
FlutterCommandCategory
.
project
;
@override
final
List
<
String
>
aliases
=
<
String
>[
'driver'
];
...
...
packages/flutter_tools/lib/src/commands/emulators.dart
View file @
3e43c3e1
...
...
@@ -31,6 +31,9 @@ class EmulatorsCommand extends FlutterCommand {
@override
final
String
description
=
'List, launch and create emulators.'
;
@override
final
String
category
=
FlutterCommandCategory
.
tools
;
@override
final
List
<
String
>
aliases
=
<
String
>[
'emulator'
];
...
...
packages/flutter_tools/lib/src/commands/format.dart
View file @
3e43c3e1
...
...
@@ -29,6 +29,9 @@ class FormatCommand extends FlutterCommand {
@override
final
String
description
=
'Format one or more Dart files.'
;
@override
String
get
category
=>
FlutterCommandCategory
.
project
;
@override
String
get
invocation
=>
'
${runner.executableName}
$name
<one or more paths>'
;
...
...
packages/flutter_tools/lib/src/commands/generate_localizations.dart
View file @
3e43c3e1
...
...
@@ -194,6 +194,9 @@ class GenerateLocalizationsCommand extends FlutterCommand {
@override
String
get
name
=>
'gen-l10n'
;
@override
String
get
category
=>
FlutterCommandCategory
.
project
;
@override
Future
<
FlutterCommandResult
>
runCommand
()
async
{
if
(
_fileSystem
.
file
(
'l10n.yaml'
).
existsSync
())
{
...
...
packages/flutter_tools/lib/src/commands/install.dart
View file @
3e43c3e1
...
...
@@ -30,6 +30,9 @@ class InstallCommand extends FlutterCommand with DeviceBasedDevelopmentArtifacts
@override
final
String
description
=
'Install a Flutter app on an attached device.'
;
@override
final
String
category
=
FlutterCommandCategory
.
tools
;
Device
device
;
bool
get
uninstallOnly
=>
boolArg
(
'uninstall-only'
);
...
...
packages/flutter_tools/lib/src/commands/logs.dart
View file @
3e43c3e1
...
...
@@ -28,6 +28,9 @@ class LogsCommand extends FlutterCommand {
@override
final
String
description
=
'Show log output for running Flutter apps.'
;
@override
final
String
category
=
FlutterCommandCategory
.
tools
;
@override
Future
<
Set
<
DevelopmentArtifact
>>
get
requiredArtifacts
async
=>
const
<
DevelopmentArtifact
>{};
...
...
packages/flutter_tools/lib/src/commands/packages.dart
View file @
3e43c3e1
...
...
@@ -50,6 +50,9 @@ class PackagesCommand extends FlutterCommand {
@override
final
String
description
=
'Commands for managing Flutter packages.'
;
@override
String
get
category
=>
FlutterCommandCategory
.
project
;
@override
Future
<
FlutterCommandResult
>
runCommand
()
async
=>
null
;
}
...
...
packages/flutter_tools/lib/src/commands/precache.dart
View file @
3e43c3e1
...
...
@@ -77,6 +77,9 @@ class PrecacheCommand extends FlutterCommand {
'If no explicit platform flags are provided, this command will download the artifacts '
'for all currently enabled platforms'
;
@override
final
String
category
=
FlutterCommandCategory
.
sdk
;
@override
bool
get
shouldUpdateCache
=>
false
;
...
...
packages/flutter_tools/lib/src/commands/run.dart
View file @
3e43c3e1
...
...
@@ -343,6 +343,9 @@ class RunCommand extends RunCommandBase {
@override
final
String
description
=
'Run your Flutter app on an attached device.'
;
@override
String
get
category
=>
FlutterCommandCategory
.
project
;
List
<
Device
>
devices
;
bool
webMode
=
false
;
...
...
packages/flutter_tools/lib/src/commands/screenshot.dart
View file @
3e43c3e1
...
...
@@ -61,6 +61,9 @@ class ScreenshotCommand extends FlutterCommand {
@override
String
get
description
=>
'Take a screenshot from a connected device.'
;
@override
final
String
category
=
FlutterCommandCategory
.
tools
;
@override
final
List
<
String
>
aliases
=
<
String
>[
'pic'
];
...
...
packages/flutter_tools/lib/src/commands/shell_completion.dart
View file @
3e43c3e1
...
...
@@ -31,6 +31,9 @@ class ShellCompletionCommand extends FlutterCommand {
'install it in your shell environment. Once it is sourced, your shell will be able to '
'complete flutter commands and options.'
;
@override
final
String
category
=
FlutterCommandCategory
.
sdk
;
@override
final
List
<
String
>
aliases
=
<
String
>[
'zsh-completion'
];
...
...
packages/flutter_tools/lib/src/commands/symbolize.dart
View file @
3e43c3e1
...
...
@@ -59,6 +59,9 @@ class SymbolizeCommand extends FlutterCommand {
@override
String
get
name
=>
'symbolize'
;
@override
final
String
category
=
FlutterCommandCategory
.
tools
;
@override
bool
get
shouldUpdateCache
=>
false
;
...
...
packages/flutter_tools/lib/src/commands/test.dart
View file @
3e43c3e1
...
...
@@ -249,6 +249,9 @@ class TestCommand extends FlutterCommand with DeviceBasedDevelopmentArtifacts {
@override
String
get
description
=>
'Run Flutter unit tests for the current project.'
;
@override
String
get
category
=>
FlutterCommandCategory
.
project
;
@override
Future
<
FlutterCommandResult
>
verifyThenRunCommand
(
String
commandPath
)
{
_testFiles
=
argResults
.
rest
.
map
<
String
>(
globals
.
fs
.
path
.
absolute
).
toList
();
...
...
packages/flutter_tools/lib/src/commands/upgrade.dart
View file @
3e43c3e1
...
...
@@ -63,6 +63,9 @@ class UpgradeCommand extends FlutterCommand {
@override
final
String
description
=
'Upgrade your copy of Flutter.'
;
@override
final
String
category
=
FlutterCommandCategory
.
sdk
;
@override
bool
get
shouldUpdateCache
=>
false
;
...
...
packages/flutter_tools/lib/src/runner/flutter_command.dart
View file @
3e43c3e1
...
...
@@ -122,6 +122,13 @@ class FlutterOptions {
static
const
String
kInitializeFromDill
=
'initialize-from-dill'
;
}
/// flutter command categories for usage.
class
FlutterCommandCategory
{
static
const
String
sdk
=
'Flutter SDK'
;
static
const
String
project
=
'Project'
;
static
const
String
tools
=
'Tools & Devices'
;
}
abstract
class
FlutterCommand
extends
Command
<
void
>
{
/// The currently executing command (or sub-command).
///
...
...
packages/flutter_tools/test/general.shard/args_test.dart
View file @
3e43c3e1
...
...
@@ -7,6 +7,7 @@
import
'package:args/args.dart'
;
import
'package:args/command_runner.dart'
;
import
'package:flutter_tools/executable.dart'
as
executable
;
import
'package:flutter_tools/src/runner/flutter_command.dart'
;
import
'package:flutter_tools/src/runner/flutter_command_runner.dart'
;
import
'../src/common.dart'
;
...
...
@@ -34,6 +35,18 @@ void verifyCommandRunner(CommandRunner<Object> runner) {
void
verifyCommand
(
Command
<
Object
>
runner
)
{
expect
(
runner
.
argParser
,
isNotNull
,
reason:
'command
${runner.name}
has no argParser'
);
verifyOptions
(
runner
.
name
,
runner
.
argParser
.
options
.
values
);
if
(
runner
.
hidden
==
false
&&
runner
.
parent
==
null
)
{
expect
(
runner
.
category
,
anyOf
(
FlutterCommandCategory
.
sdk
,
FlutterCommandCategory
.
project
,
FlutterCommandCategory
.
tools
,
),
reason:
"top-level command
${runner.name}
doesn't have a valid category"
,
);
}
runner
.
subcommands
.
values
.
forEach
(
verifyCommand
);
}
...
...
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