|
VoltMod
C++23 framework for CS2 server plugins
|
Fluent command registration, returned by CommandManager::Add. More...
#include <CommandBuilder.hpp>
Public Types | |
| using | Installer = std::function< void(CommandDefinition)> |
Public Member Functions | |
| CommandBuilder (Installer install, std::string_view name) | |
| CommandBuilder & | Alias (std::string_view alias) |
| CommandBuilder & | Describe (std::string_view text) |
| CommandBuilder & | Permission (std::string_view permission) |
| CommandBuilder & | Anywhere () |
| CommandBuilder & | ServerOnly () |
| CommandBuilder & | UsageKey (std::string_view key) |
| template<class F > | |
| void | Run (F &&handler) |
Fluent command registration, returned by CommandManager::Add.
Run installs the command. The manager owns it for the plugin load cycle.
Definition at line 191 of file CommandBuilder.hpp.
| using VoltMod::CommandBuilder::Installer = std::function<void(CommandDefinition)> |
How Run hands the finished definition back to the manager that made this builder.
Definition at line 195 of file CommandBuilder.hpp.
|
inline |
Definition at line 197 of file CommandBuilder.hpp.
References VoltMod::CommandDefinition::Name.
|
inline |
Another name for the same command. Collisions are refused and logged at registration.
Definition at line 203 of file CommandBuilder.hpp.
References VoltMod::CommandDefinition::Aliases, and VoltMod::ReadFile().
|
inline |
Also register a tier1 ConCommand, so players can type it in their console and the server can run it from its console, rcon, cfg files and ExecuteServerCommand.
Definition at line 225 of file CommandBuilder.hpp.
References VoltMod::CommandDefinition::Access, and VoltMod::Anywhere.
|
inline |
Operator-facing description; also the console command's help text.
Definition at line 210 of file CommandBuilder.hpp.
References VoltMod::CommandDefinition::Description, and VoltMod::ReadFile().
|
inline |
Gate on Policy::Authorize, which denies while no plugin publishes IPermissions.
Definition at line 217 of file CommandBuilder.hpp.
References VoltMod::CommandDefinition::PermissionName, and VoltMod::ReadFile().
Install the command. The handler takes a Caller and one Args:: value per argument; that list defines arity, parsing, and usage. A handler that returns nothing succeeds silently.
The command is unregistered when CommandManager is destroyed.
Definition at line 253 of file CommandBuilder.hpp.
References VoltMod::ReadFile().
|
inline |
Register only the ConCommand, for an operator command players cannot run.
Definition at line 232 of file CommandBuilder.hpp.
References VoltMod::CommandDefinition::Access, and VoltMod::ServerOnly.
|
inline |
Translation key for the whole usage line, replacing the one derived from the argument types.
Definition at line 240 of file CommandBuilder.hpp.
References VoltMod::ReadFile(), and VoltMod::CommandDefinition::UsageKey.