Skip to content

Commit f6457fd

Browse files
authored
Add customizable category to pub Command (#4611)
1 parent 81409a1 commit f6457fd

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

lib/pub.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,10 @@ export 'src/executable.dart'
2222
///
2323
/// [isVerbose] should return `true` (after argument resolution) if the
2424
/// embedding top-level is in verbose mode.
25-
Command<int> pubCommand({required bool Function() isVerbose}) =>
26-
PubEmbeddableCommand(isVerbose);
25+
Command<int> pubCommand({
26+
required bool Function() isVerbose,
27+
String category = '',
28+
}) => PubEmbeddableCommand(isVerbose, category);
2729

2830
/// Makes sure that [dir]/pubspec.yaml is resolved such that pubspec.lock and
2931
/// .dart_tool/package_config.json are up-to-date and all packages are

lib/src/pub_embeddable_command.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,10 @@ class PubEmbeddableCommand extends PubCommand implements PubTopLevel {
4545

4646
final bool Function() isVerbose;
4747

48-
PubEmbeddableCommand(this.isVerbose) : super() {
48+
@override
49+
final String category;
50+
51+
PubEmbeddableCommand(this.isVerbose, this.category) : super() {
4952
// This flag was never honored in the embedding but since it was accepted we
5053
// leave it as a hidden flag to avoid breaking clients that pass it.
5154
argParser.addFlag('trace', hide: true);

0 commit comments

Comments
 (0)