-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathuninstall_completion_files_command.dart
More file actions
52 lines (44 loc) · 1.41 KB
/
uninstall_completion_files_command.dart
File metadata and controls
52 lines (44 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import 'dart:async';
import 'package:args/command_runner.dart';
import 'package:cli_completion/cli_completion.dart';
import 'package:mason_logger/mason_logger.dart';
/// {@template ninstall_completion_command}
/// A hidden [Command] added by [CompletionCommandRunner] that handles the
/// "uninstall-completion-files" sub command.
///
/// It can be used to manually uninstall the completion files
/// (those installed by [CompletionCommandRunner] or
/// [InstallCompletionFilesCommand]).
/// {@endtemplate}
class UnistallCompletionFilesCommand<T> extends Command<T> {
/// {@macro uninstall_completion_command}
UnistallCompletionFilesCommand() {
argParser.addFlag(
'verbose',
abbr: 'v',
help: 'Verbose output',
negatable: false,
);
}
@override
String get description {
return 'Manually uninstalls completion files for the current shell.';
}
/// The string that the user can call to manually uninstall completion files.
static const commandName = 'uninstall-completion-files';
@override
String get name => commandName;
@override
bool get hidden => true;
@override
CompletionCommandRunner<T> get runner {
return super.runner! as CompletionCommandRunner<T>;
}
@override
FutureOr<T>? run() {
final verbose = argResults!['verbose'] as bool;
final level = verbose ? Level.verbose : Level.info;
runner.tryUninstallCompletionFiles(level);
return null;
}
}