enablePlugin method
CLI: Enable a plugin.
Implementation
Future<PluginOperationResult> enablePlugin(
String plugin, [
PluginScope? scope,
]) async {
try {
final result = await operations.enablePlugin(plugin, scope);
if (!result.success) {
writeError(
'Failed to enable plugin "$plugin": ${result.message}',
);
_logFailure('enable', plugin);
return result;
}
writeOutput('Successfully enabled: ${result.pluginName}');
final id = parsePluginIdentifier(result.pluginId ?? plugin);
logEvent('tengu_plugin_enabled_cli', {
...buildPluginTelemetryFields(
id.name,
id.marketplace,
getManagedPluginNames(),
).toMap(),
'scope': result.scope?.name,
});
return result;
} catch (e) {
_handleError(e, 'enable', plugin);
return PluginOperationResult(
success: false,
message: e.toString(),
);
}
}