runCommand method
Runs the command specified by topLevelResults
.
This is notionally a protected method. It may be overridden or called from subclasses, but it shouldn't be called externally.
It's useful to override this to handle global flags and/or wrap the entire
command in a block. For example, you might handle the --verbose
flag
here to enable verbose logging before running the command.
This returns the return value of Command.run
.
Implementation
@override
@mustCallSuper
Future<T?> runCommand(ArgResults topLevelResults) async {
final reservedCommands = [
HandleCompletionRequestCommand.commandName,
InstallCompletionFilesCommand.commandName,
];
if (enableAutoInstall &&
!reservedCommands.contains(topLevelResults.command?.name)) {
// When auto installing, use error level to display messages.
tryInstallCompletionFiles(Level.error);
}
return super.runCommand(topLevelResults);
}