Add customizable `category` to pub `Command` (#4611)

diff --git a/lib/pub.dart b/lib/pub.dart
index 1586047..d7b5653 100644
--- a/lib/pub.dart
+++ b/lib/pub.dart
@@ -22,8 +22,10 @@
 ///
 /// [isVerbose] should return `true` (after argument resolution) if the
 /// embedding top-level is in verbose mode.
-Command<int> pubCommand({required bool Function() isVerbose}) =>
-    PubEmbeddableCommand(isVerbose);
+Command<int> pubCommand({
+  required bool Function() isVerbose,
+  String category = '',
+}) => PubEmbeddableCommand(isVerbose, category);
 
 /// Makes sure that [dir]/pubspec.yaml is resolved such that pubspec.lock and
 /// .dart_tool/package_config.json are up-to-date and all packages are
diff --git a/lib/src/pub_embeddable_command.dart b/lib/src/pub_embeddable_command.dart
index a2671fd..408d00a 100644
--- a/lib/src/pub_embeddable_command.dart
+++ b/lib/src/pub_embeddable_command.dart
@@ -45,7 +45,10 @@
 
   final bool Function() isVerbose;
 
-  PubEmbeddableCommand(this.isVerbose) : super() {
+  @override
+  final String category;
+
+  PubEmbeddableCommand(this.isVerbose, this.category) : super() {
     // This flag was never honored in the embedding but since it was accepted we
     // leave it as a hidden flag to avoid breaking clients that pass it.
     argParser.addFlag('trace', hide: true);