/
krasninja
/
querycat
Обзор
Документация
Войти
/
krasninja
/
querycat
Код
Пакеты
0
Релизы
0
Аналитика
Безопасность
develop
src/QueryCat.Cli/Commands/PluginRemoveCommand.cs
27 строк
872 B
Ivan Kozhin
"Rebalance" utils (again), improve AOT support
22 дек 2023, 08:49
22 дек 2023, 08:49
b81d64f
Код
Авторство
О чём код?
using System.CommandLine; using QueryCat.Backend.Core.Utils; using QueryCat.Cli.Commands.Options; namespace QueryCat.Cli.Commands; #if ENABLE_PLUGINS internal class PluginRemoveCommand : BaseCommand { /// <inheritdoc /> public PluginRemoveCommand() : base("remove", "Remove the plugin.") { var pluginArgument = new Argument<string>("plugin", "Plugin name."); this.AddArgument(pluginArgument); this.SetHandler((applicationOptions, plugin) => { applicationOptions.InitializeLogger(); AsyncUtils.RunSync(async ct => { using var root = applicationOptions.CreateApplicationRoot(); await root.PluginsManager.RemoveAsync(plugin, ct); }); }, new ApplicationOptionsBinder(LogLevelOption, PluginDirectoriesOption), pluginArgument); } } #endif