Skip to content

Commit 59ed4eb

Browse files
dcharkesCommit Queue
authored andcommitted
[dartdev] Organize dart --help commands into categories (2)
TEST=pkg/dartdev/test/commands/help_test.dart Change-Id: I4e6eed1093412c8b307713c0faf95a84d56b5f26 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/436905 Reviewed-by: Ben Konyi <[email protected]> Commit-Queue: Daco Harkes <[email protected]>
1 parent 560b017 commit 59ed4eb

19 files changed

+82
-18
lines changed

pkg/dartdev/lib/dartdev.dart

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,17 @@ 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, category: 'Source code'));
119+
addCommand(FormatCommand(
120+
verbose: verbose,
121+
category: CommandCategory.sourceCode.name,
122+
));
120123
addCommand(InfoCommand(verbose: verbose));
121124
addCommand(LanguageServerCommand(verbose: verbose));
122125
addCommand(DartMCPServerCommand(verbose: verbose));
123-
addCommand(pubCommand(isVerbose: () => verbose, category: 'Project'));
126+
addCommand(pubCommand(
127+
isVerbose: () => verbose,
128+
category: CommandCategory.project.name,
129+
));
124130
addCommand(RunCommand(
125131
verbose: verbose,
126132
nativeAssetsExperimentEnabled: nativeAssetsExperimentEnabled,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ class AnalyzeCommand extends DartdevCommand {
100100
}
101101

102102
@override
103-
String get category => 'Source code';
103+
CommandCategory get commandCategory => CommandCategory.sourceCode;
104104

105105
@override
106106
String get invocation => '${super.invocation} [<directory>]';

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class BuildCommand extends DartdevCommand {
3636
}
3737

3838
@override
39-
String get category => 'Project';
39+
CommandCategory get commandCategory => CommandCategory.project;
4040
}
4141

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

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class CompilationServerCommand extends DartdevCommand {
4444
}
4545

4646
@override
47-
String get category => 'Tools';
47+
CommandCategory get commandCategory => CommandCategory.tools;
4848
}
4949

5050
class CompilationServerStartCommand extends DartdevCommand {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1148,5 +1148,5 @@ class CompileCommand extends DartdevCommand {
11481148
}
11491149

11501150
@override
1151-
String get category => 'Project';
1151+
CommandCategory get commandCategory => CommandCategory.project;
11521152
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class CreateCommand extends DartdevCommand {
6262
String get invocation => '${super.invocation} <directory>';
6363

6464
@override
65-
String get category => 'Project';
65+
CommandCategory get commandCategory => CommandCategory.project;
6666

6767
@override
6868
FutureOr<int> run() async {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ EXPERIMENTAL: This tool may change dramatically or disappear at any time.''';
4040
}
4141

4242
@override
43-
String get category => 'Tools';
43+
CommandCategory get commandCategory => CommandCategory.tools;
4444

4545
@override
4646
Future<int> run() async {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class DebugAdapterCommand extends DartdevCommand {
6060
}
6161

6262
@override
63-
String get category => 'Tools';
63+
CommandCategory get commandCategory => CommandCategory.tools;
6464

6565
@override
6666
FutureOr<int> run() async {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class DevelopmentServiceCommand extends DartdevCommand {
3131
}
3232

3333
@override
34-
String get category => 'Tools';
34+
CommandCategory get commandCategory => CommandCategory.tools;
3535

3636
@override
3737
Future<int> run() async {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class DevToolsCommand extends DartdevCommand {
4040
String get name => 'devtools';
4141

4242
@override
43-
String get category => 'Tools';
43+
CommandCategory get commandCategory => CommandCategory.tools;
4444

4545
@override
4646
String get description => DevToolsServer.commandDescription;

0 commit comments

Comments
 (0)