24typedef std::function<int32_t(std::shared_ptr<Console> console, std::vector<std::string> args, std::string* output)>
87 int32_t
Run(
const std::string& command, std::string* output);
135 void OnInit(
const nlohmann::json& initArgs = nlohmann::json::object())
override;
138 std::map<std::string, CommandEntry> mCommands;
A named Part with a parent/child hierarchy and optional thread safety.
Definition Component.h:34
In-process command interpreter used by ConsoleWindow.
Definition Console.h:63
CommandEntry & GetCommand(const std::string &command)
Returns a reference to the CommandEntry for the given command name.
bool HasCommand(const std::string &command)
Returns true if a command with the given name is registered.
std::string BuildUsage(const std::string &command)
Builds a usage string from the command's argument list.
std::string BuildUsage(const CommandEntry &entry)
Builds a usage string directly from a CommandEntry.
void OnInit(const nlohmann::json &initArgs=nlohmann::json::object()) override
Registers built-in commands. Called automatically by Component::Init().
std::map< std::string, CommandEntry > & GetCommands()
Returns the full command registry (name → entry map).
void AddCommand(const std::string &command, CommandEntry entry)
Registers a new command.
int32_t Run(const std::string &command, std::string *output)
Registers built-in commands. Called by Component::Init().
Core namespace for the libultraship engine framework.
Definition gfx_direct3d_common.h:14
ArgumentType
Describes the expected type of a command argument.
Definition Console.h:28
std::function< int32_t(std::shared_ptr< Console > console, std::vector< std::string > args, std::string *output)> CommandHandler
Signature of a function that handles a console command.
Definition Console.h:25
Metadata for a single positional argument of a console command.
Definition Console.h:33
ArgumentType Type
Expected value type (text or numeric).
Definition Console.h:35
bool Optional
If true, the argument may be omitted.
Definition Console.h:36
std::string Info
Human-readable description of the argument.
Definition Console.h:34
Registration record for a single console command.
Definition Console.h:42
std::vector< CommandArgument > Arguments
Ordered list of expected arguments.
Definition Console.h:45
CommandHandler Handler
Callable invoked when the command is executed.
Definition Console.h:43
std::string Description
Short description shown by the "help" command.
Definition Console.h:44