1
1
import 'package:args/args.dart' ;
2
2
import 'package:args/command_runner.dart' ;
3
+ import 'package:cli_completion/cli_completion.dart' ;
3
4
import 'package:mason/mason.dart' hide packageVersion;
4
5
import 'package:pub_updater/pub_updater.dart' ;
5
6
import 'package:usage/usage_io.dart' ;
@@ -18,7 +19,7 @@ const packageName = 'very_good_cli';
18
19
/// {@template very_good_command_runner}
19
20
/// A [CommandRunner] for the Very Good CLI.
20
21
/// {@endtemplate}
21
- class VeryGoodCommandRunner extends CommandRunner <int > {
22
+ class VeryGoodCommandRunner extends CompletionCommandRunner <int > {
22
23
/// {@macro very_good_command_runner}
23
24
VeryGoodCommandRunner ({
24
25
Analytics ? analytics,
@@ -85,6 +86,7 @@ class VeryGoodCommandRunner extends CommandRunner<int> {
85
86
normalizedResponse == 'y' || normalizedResponse == 'yes' ;
86
87
}
87
88
final _argResults = parse (args);
89
+
88
90
if (_argResults['verbose' ] == true ) {
89
91
_logger.level = Level .verbose;
90
92
}
@@ -107,6 +109,11 @@ class VeryGoodCommandRunner extends CommandRunner<int> {
107
109
108
110
@override
109
111
Future <int ?> runCommand (ArgResults topLevelResults) async {
112
+ if (topLevelResults.command? .name == 'completion' ) {
113
+ await super .runCommand (topLevelResults);
114
+ return ExitCode .success.code;
115
+ }
116
+
110
117
_logger
111
118
..detail ('Argument information:' )
112
119
..detail (' Top level options:' );
0 commit comments