Skip to content

Commit

Permalink
feat: add reenable command
Browse files Browse the repository at this point in the history
  • Loading branch information
ShrBox committed Feb 29, 2024
1 parent 03feca5 commit 36f2a8d
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions src/ll/core/command/PluginManage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace ll::command {
using namespace ll::i18n_literals;

enum LeviCommandOperation : int { load = 0, unload = 1, reload = 2 };
enum LeviCommandOperation2 : int { enable = 0, disable = 1, show = 2 };
enum LeviCommandOperation2 : int { enable = 0, disable = 1, reenable = 2, show = 3 };
struct LeviCommand {
LeviCommandOperation operation;
std::string plugin;
Expand Down Expand Up @@ -131,10 +131,22 @@ void registerPluginManageCommand() {
}
break;
}
case LeviCommandOperation2::reenable:
if (ll::plugin::PluginManagerRegistry::getInstance().hasPlugin(param.plugin)) {
if (ll::plugin::PluginRegistrar::getInstance().disablePlugin(param.plugin)
&& ll::plugin::PluginRegistrar::getInstance().enablePlugin(param.plugin)) {
output.success("Reenable plugin {0} successfully"_tr(param.plugin));
} else {
output.error("Failed to reenable plugin {0}"_tr(param.plugin));
}
} else {
output.error("Plugin {0} not found"_tr(param.plugin));
}
break;
default:
break;
}
}>(

);
}>();
cmd.overload().text("list").execute<[](CommandOrigin const& origin, CommandOutput& output) {
unsigned short amount = 0;
std::string plugins;
Expand Down

0 comments on commit 36f2a8d

Please sign in to comment.