Elaztek Developer Hub
Blamite Game Engine - blam!  00423.10.27.24.0533.blamite
The core library for the Blamite Game Engine.
classify.hpp
Go to the documentation of this file.
1 #include "../console.h"
2 
4 #include "core.h"
5 
7 {
14  {
15  public:
17  {
18  name = "classify";
19  description = "Provides information on a command";
20  aliases = { "man" };
21 
23  }
24 
25  BlamResult Execute(std::vector<std::string> arguments)
26  {
27  if (arguments.size() == 0)
28  {
29  return BlamResult::Error_Command_WrongArgumentCount;
30  }
31 
33 
34  if (!command)
35  {
36  return BlamResult::Error_Command_InvalidArguments;
37  }
38 
40  Blam::Logger::LogEventForce(" " + command->description, WSV_NONE);
41 
42  Blam::Logger::LogEventForce(" syntax: " + command->syntax, *Blam::Globals::GetGlobalAsColor("aqua"));
43 
44  if (command->aliases.size() > 0)
45  {
46  std::string aliases = "";
47 
48  for (int i = 0; i < command->aliases.size(); i++)
49  {
50  if (i == command->aliases.size() - 1)
51  {
52  aliases += command->aliases[i];
53  }
54  else
55  {
56  aliases += command->aliases[i] + ", ";
57  }
58  }
59 
61  }
62 
63  return BlamResult::Success_OK;
64  }
65  };
66 }
BlamConsoleCommand::description
std::string description
An optional description of the command. Shown when using the classify command.
Definition: console.h:36
logger.h
BlamConsoleCommand
Class used to represent a console command.
Definition: console.h:33
Blam::Resources::Console::GetCommand
BLAM BlamConsoleCommand * GetCommand(std::string name)
Retrieves a command with the specified name.
Definition: console.cpp:237
Blam::Globals::GetGlobalAsColor
BLAM BlamColor * GetGlobalAsColor(std::string name)
Retrieves a global's value as a BlamColor.
Definition: globals.cpp:415
Blam::Resources::Console::ClassifyCommand
Class for the classify command.
Definition: classify.hpp:13
Blam::Resources::Console::ClassifyCommand::Execute
BlamResult Execute(std::vector< std::string > arguments)
Called upon command execution.
Definition: classify.hpp:25
Blam::Resources::Console::ClassifyCommand::ClassifyCommand
ClassifyCommand()
Definition: classify.hpp:16
BlamConsoleCommand::name
std::string name
The name of the console command.
Definition: console.h:35
BlamConsoleCommand::syntax
std::string syntax
The syntax information for the command. Shown to the user when using the help command with an argumen...
Definition: console.h:37
BlamConsoleCommand::type
BlamCommandType type
The type of command this is. See #Blam::Resources::Console::BlamCommandType for more information.
Definition: console.h:40
Blam::Logger::LogEventForce
BLAM void LogEventForce(std::string message)
Forcibly logs a message to the log and/or console.
Definition: aliases.cpp:262
BlamConsoleCommand::aliases
std::vector< std::string > aliases
A list of aliases for the command. Executing any of these instead of the command name will behave the...
Definition: console.h:38
Blam::Resources::Console
Namespace for things relating to the debug console.
Definition: abort.hpp:5
BlamCommandType::Builtin
@ Builtin
A command that is hard-coded into the engine.