3#include "BuildStamp.hpp"
9#include <tier1/convar.h>
16 "volt version | list | status [name] | load <name> | unload <name> | reload <name> | "
17 "log <name> <info|warn|error>";
24 _registry.RegisterHostCommand(
"volt");
35 if (
verb ==
"version")
39 else if (
verb ==
"list")
43 else if (
verb ==
"status")
59 else if (
verb ==
"log" && !
target.empty() && !value.empty())
61 SetLogLevel(
target, value);
69void VoltCommand::PrintVersion()
const
74void VoltCommand::PrintLoaded()
const
88 const std::string_view description =
plugin.Manifest.Description;
90 description.empty() ?
"" :
" - ", description);
104void VoltCommand::PrintStatus(std::string_view name)
106 const auto print = [](
const LoadedPlugin&
plugin) {
113 for (
const LoadedPlugin&
plugin : _loader.LoadedPlugins())
126void VoltCommand::SetLogLevel(std::string_view name, std::string_view
level)
131 Log::Warn(
"'{}' is not a log level. Use info, warn or error.",
level);
Enumerator names without a hand-written switch.
void SetMinLogLevel(LogLevel level)
Finds the installed plugins and loads the ones their dependencies allow.
LoadedPlugin * RequireLoaded(std::string_view name)
const std::map< std::string, std::string > & Refused() const
const std::vector< LoadedPlugin > & LoadedPlugins() const
void Defer(ActionKind kind, std::string_view name)
The loaded plugins and the engine events raised on them, one per process.
PluginContext * FindPlugin(std::string_view name)
static std::string ToLower(std::string_view str)
VoltCommand(PluginRegistry ®istry, PluginLoader &loader)
void Info(std::format_string< Args... > fmt, Args &&... args)
void Warn(std::format_string< Args... > fmt, Args &&... args)
static std::string ReadFile(const std::filesystem::path &path)
static constexpr std::string_view CommandUsage