|
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 & | PlayersOnly () |
| CommandBuilder & | PlayersAndServer () |
| 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 193 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 197 of file CommandBuilder.hpp.
|
inline |
Definition at line 199 of file CommandBuilder.hpp.
Referenced by Alias(), Describe(), Permission(), PlayersAndServer(), PlayersOnly(), ServerOnly(), and UsageKey().
|
inline |
Another name for the same command. Collisions are refused and logged at registration.
Definition at line 205 of file CommandBuilder.hpp.
References CommandBuilder().
|
inline |
Operator-facing description; also the console command's help text.
Definition at line 212 of file CommandBuilder.hpp.
References CommandBuilder().
|
inline |
Gate on Policy::Authorize, which denies while no plugin publishes IPermissions.
Definition at line 219 of file CommandBuilder.hpp.
References CommandBuilder().
|
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 235 of file CommandBuilder.hpp.
References CommandBuilder(), and VoltMod::PlayersAndServer.
|
inline |
Also register a tier1 ConCommand that only players can run, so they can type it in their console or bind it to a key. The server console, rcon and cfg files are refused.
Definition at line 227 of file CommandBuilder.hpp.
References CommandBuilder(), and VoltMod::Players.
|
inline |
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 263 of file CommandBuilder.hpp.
|
inline |
Register only the ConCommand, for an operator command players cannot run.
Definition at line 242 of file CommandBuilder.hpp.
References CommandBuilder(), and VoltMod::ServerOnly.
|
inline |
Translation key for the whole usage line, replacing the one derived from the argument types.
Definition at line 250 of file CommandBuilder.hpp.
References CommandBuilder(), and UsageKey().
Referenced by UsageKey().