Skip to content

Commit 2273611

Browse files
dcharkesCommit Queue
authored andcommitted
[dartdev] Organize dart --help commands into categories
This CL organizes the commands in the Dart CLI to categories. It mirrors the categories used in `flutter --help`: `SDK`, `Project`, and `Tools`. The available command section will now look as follows in verbose mode: ``` Available commands: Project build Build a Dart application including native assets. compile Compile Dart to various formats. create Create a new Dart project. pub Work with packages. run Run a Dart program. test Run tests for a project. Source code analyze Analyze Dart code in a directory. doc Generate API documentation for Dart projects. fix Apply automated fixes to Dart source code. format Idiomatically format Dart source code. Tools compilation-server Control resident frontend compilers. development-service Start Dart's development service. devtools Open DevTools (optionally connecting to an existing application). info Show diagnostic information about the installed tooling. language-server Start Dart's analysis server. tooling-daemon Start Dart's tooling daemon. ``` Bug: #60980 Change-Id: Ic9da297fcdd0f8e85d619632ba8ec30fd2c32666 Cq-Include-Trybots: luci.dart.try:pkg-linux-debug-try,pkg-linux-release-arm64-try,pkg-linux-release-try,pkg-mac-release-arm64-try,pkg-mac-release-try,pkg-win-release-arm64-try,pkg-win-release-try Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/436382 Reviewed-by: Michael Thomsen <[email protected]> Commit-Queue: Daco Harkes <[email protected]>
1 parent 931ec38 commit 2273611

17 files changed

+54
-7
lines changed

pkg/dartdev/lib/dartdev.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,11 @@ class DartdevRunner extends CommandRunner<int> {
116116
addCommand(DevToolsCommand(verbose: verbose));
117117
addCommand(DocCommand(verbose: verbose));
118118
addCommand(FixCommand(verbose: verbose));
119-
addCommand(FormatCommand(verbose: verbose));
119+
addCommand(FormatCommand(verbose: verbose, category: 'Source code'));
120120
addCommand(InfoCommand(verbose: verbose));
121121
addCommand(LanguageServerCommand(verbose: verbose));
122122
addCommand(DartMCPServerCommand(verbose: verbose));
123-
addCommand(pubCommand(isVerbose: () => verbose));
123+
addCommand(pubCommand(isVerbose: () => verbose, category: 'Project'));
124124
addCommand(RunCommand(
125125
verbose: verbose,
126126
nativeAssetsExperimentEnabled: nativeAssetsExperimentEnabled,

pkg/dartdev/lib/src/commands/analyze.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,9 @@ class AnalyzeCommand extends DartdevCommand {
9999
..addExperimentalFlags();
100100
}
101101

102+
@override
103+
String get category => 'Source code';
104+
102105
@override
103106
String get invocation => '${super.invocation} [<directory>]';
104107

pkg/dartdev/lib/src/commands/build.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ class BuildCommand extends DartdevCommand {
3434
recordUseEnabled: recordUseEnabled,
3535
));
3636
}
37+
38+
@override
39+
String get category => 'Project';
3740
}
3841

3942
/// Subcommand for `dart build cli`.

pkg/dartdev/lib/src/commands/compilation_server.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ class CompilationServerCommand extends DartdevCommand {
4242
addSubcommand(CompilationServerStartCommand());
4343
addSubcommand(CompilationServerShutdownCommand());
4444
}
45+
46+
@override
47+
String get category => 'Tools';
4548
}
4649

4750
class CompilationServerStartCommand extends DartdevCommand {

pkg/dartdev/lib/src/commands/compile.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1145,4 +1145,7 @@ class CompileCommand extends DartdevCommand {
11451145
));
11461146
addSubcommand(CompileWasmCommand(verbose: verbose));
11471147
}
1148+
1149+
@override
1150+
String get category => 'Project';
11481151
}

pkg/dartdev/lib/src/commands/create.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ class CreateCommand extends DartdevCommand {
6161
@override
6262
String get invocation => '${super.invocation} <directory>';
6363

64+
@override
65+
String get category => 'Project';
66+
6467
@override
6568
FutureOr<int> run() async {
6669
final args = argResults!;

pkg/dartdev/lib/src/commands/dart_mcp_server.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ EXPERIMENTAL: This tool may change dramatically or disappear at any time.''';
3939
'experimental feature with no stability guarantees.');
4040
}
4141

42+
@override
43+
String get category => 'Tools';
44+
4245
@override
4346
Future<int> run() async {
4447
final args = argResults!;

pkg/dartdev/lib/src/commands/debug_adapter.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ class DebugAdapterCommand extends DartdevCommand {
5959
);
6060
}
6161

62+
@override
63+
String get category => 'Tools';
64+
6265
@override
6366
FutureOr<int> run() async {
6467
final args = argResults!;

pkg/dartdev/lib/src/commands/development_service.dart

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ class DevelopmentServiceCommand extends DartdevCommand {
3030
);
3131
}
3232

33+
@override
34+
String get category => 'Tools';
35+
3336
@override
3437
Future<int> run() async {
3538
final sdkDir = dirname(sdk.dart);
@@ -47,12 +50,11 @@ class DevelopmentServiceCommand extends DartdevCommand {
4750
// On ia32 platforms we do not have an AOT snapshot and so we need
4851
// to run the JIT snapshot.
4952
useExecProcess = false;
50-
script = fullSdk
51-
? sdk.ddsSnapshot
52-
: absolute(sdkDir, 'dds.dart.snapshot');
53+
script =
54+
fullSdk ? sdk.ddsSnapshot : absolute(sdkDir, 'dds.dart.snapshot');
5355
if (!Sdk.checkArtifactExists(script, logError: false)) {
5456
log.stderr('Error: launching development server failed : '
55-
'Unable to find snapshot for the development server');
57+
'Unable to find snapshot for the development server');
5658
return 255;
5759
}
5860
}

pkg/dartdev/lib/src/commands/devtools.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ class DevToolsCommand extends DartdevCommand {
3939
@override
4040
String get name => 'devtools';
4141

42+
@override
43+
String get category => 'Tools';
44+
4245
@override
4346
String get description => DevToolsServer.commandDescription;
4447

0 commit comments

Comments
 (0)