Elaztek Developer Hub
Blamite Game Engine - Tool (Library)
A command-line utility that aids in the creation of Blamite Cache (.map) Files.
ListProjectsCommand.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include <Strings/components/logger/logger.h>
4 #include <HEKGuerilla/components/projects/projects.h>
5 
6 #include "../ToolCommand.hpp"
7 #include "../console.h"
8 
9 #ifdef TOOL_LIB_EXPORTS
10 #define TOOL_LIB_API __declspec(dllexport)
11 #else
12 #define TOOL_LIB_API __declspec(dllimport)
13 #endif
14 
22 {
23 public:
25  {
26  command = "list-projects";
27  syntax = "list-projects";
28  description = "displays all known projects and an associated id. ids from this can be used in choose-project.";
29  }
30 
31  int execute(std::vector<std::string> args)
32  {
33  Guerilla::Projects::LoadProjects();
34  std::vector<BlamProject*> projects = Guerilla::Projects::GetLoadedProjects();
35 
36  BlamStrings::Logger::LogEvent("id | project | path");
37 
38  for (int i = 0; i < projects.size(); i++)
39  {
40  BlamStrings::Logger::LogEvent(std::to_string(i) + " | " + projects.at(i)->project_name + " | " + projects.at(i)->project_root);
41  }
42 
43  return 0;
44  }
45 };
ListProjectsCommand
Class for the list-projects command.
Definition: ListProjectsCommand.hpp:21
ListProjectsCommand::execute
int execute(std::vector< std::string > args)
Executes the command.
Definition: ListProjectsCommand.hpp:31
ToolCommand::syntax
std::string syntax
The syntax of the command. This should include the command name, as well as any arguments.
Definition: ToolCommand.hpp:19
ToolCommand::command
std::string command
The name of the command.
Definition: ToolCommand.hpp:18
ListProjectsCommand::ListProjectsCommand
ListProjectsCommand()
Definition: ListProjectsCommand.hpp:24
ToolCommand
Base class representing a Tool command.
Definition: ToolCommand.hpp:15
ToolCommand::description
std::string description
A description of the command.
Definition: ToolCommand.hpp:20