Fixes
This commit is contained in:
10
CLI/CMakeLists.txt
Normal file
10
CLI/CMakeLists.txt
Normal file
@ -0,0 +1,10 @@
|
||||
set(SRC_FILES
|
||||
"Src/Imp/CPP/Main.cpp"
|
||||
"Src/Imp/CPP/CLI.cpp"
|
||||
)
|
||||
|
||||
add_executable(IAE ${SRC_FILES})
|
||||
|
||||
target_include_directories(IAE PRIVATE "Src/Imp/HPP")
|
||||
|
||||
target_link_libraries(IAE PRIVATE IAEngine)
|
||||
76
CLI/Src/Imp/CPP/CLI.cpp
Normal file
76
CLI/Src/Imp/CPP/CLI.cpp
Normal file
@ -0,0 +1,76 @@
|
||||
// IAEngine: 2D Game Engine by IA
|
||||
// Copyright (C) 2025 IASoft (PVT) LTD (oss@iasoft.dev)
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#include <CLI.hpp>
|
||||
|
||||
#include <IACore/File.hpp>
|
||||
|
||||
#include <filesystem>
|
||||
|
||||
namespace ia::iae
|
||||
{
|
||||
#define REPORT_STATUS(...) printf(__CC_MAGENTA "%s" __CC_DEFAULT "\n", BuildString(__VA_ARGS__).c_str())
|
||||
#define REPORT_ERROR(...) printf(__CC_RED "%s" __CC_DEFAULT "\n", BuildString(__VA_ARGS__).c_str())
|
||||
#define REPORT_SUCCESS(...) printf(__CC_GREEN "%s" __CC_DEFAULT "\n", BuildString(__VA_ARGS__).c_str())
|
||||
|
||||
CLI::CLI() : ia::CLI("IAEngine CLI", IA_MAKE_VERSION(1, 0, 0), "Copyright (C) 2025 IASoft (PVT) LTD")
|
||||
{
|
||||
RegisterCommand({
|
||||
.ID = "new",
|
||||
.Shorthand = 'n',
|
||||
.Help = "Creates a new game project",
|
||||
.Parameters =
|
||||
{
|
||||
{
|
||||
.ID = "name",
|
||||
.Help = "Name of the project to be created",
|
||||
.IsOptional = false,
|
||||
.Type = ParameterValueType::STRING,
|
||||
},
|
||||
},
|
||||
.Action = [&](IN Map<String, ParameterValue>&& params, IN Map<String, BOOL>&& switches)
|
||||
{
|
||||
try {
|
||||
CreateNewProject(params["name"].StringValue);
|
||||
} catch(CONST std::exception& e) {
|
||||
IAE_LOG_ERROR("EXCEPTION: ", e.what());
|
||||
return -4;
|
||||
}
|
||||
return 0;
|
||||
},
|
||||
});
|
||||
// RegisterCommand({.ID = "run", .Shorthand = 'r', .Help = ""});
|
||||
// RegisterCommand({.ID = "debug", .Shorthand = 'd', .Help = ""});
|
||||
// RegisterCommand({.ID = "clean", .Shorthand = 'c', .Help = ""});
|
||||
// RegisterCommand({.ID = "build", .Shorthand = 'b', .Help = ""});
|
||||
// RegisterCommand({.ID = "rebuild", .Shorthand = 'e', .Help = ""});
|
||||
// RegisterCommand({.ID = "package", .Shorthand = 'p', .Help = ""});
|
||||
}
|
||||
|
||||
VOID CLI::CreateNewProject(IN CONST String& name)
|
||||
{
|
||||
if(std::filesystem::exists(name.c_str()))
|
||||
{
|
||||
REPORT_ERROR("Directory \"", name, "\" already exists. Aborting..");
|
||||
return;
|
||||
}
|
||||
|
||||
REPORT_STATUS("Creating Project ", name, "..");
|
||||
std::filesystem::create_directories(name.c_str());
|
||||
|
||||
|
||||
}
|
||||
} // namespace ia::iae
|
||||
23
CLI/Src/Imp/CPP/Main.cpp
Normal file
23
CLI/Src/Imp/CPP/Main.cpp
Normal file
@ -0,0 +1,23 @@
|
||||
// IAEngine: 2D Game Engine by IA
|
||||
// Copyright (C) 2025 IASoft (PVT) LTD (oss@iasoft.dev)
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#include <CLI.hpp>
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
ia::iae::CLI cli{};
|
||||
return cli.Run(argc, (ia::PCCHAR*)argv);
|
||||
}
|
||||
32
CLI/Src/Imp/HPP/CLI.hpp
Normal file
32
CLI/Src/Imp/HPP/CLI.hpp
Normal file
@ -0,0 +1,32 @@
|
||||
// IAEngine: 2D Game Engine by IA
|
||||
// Copyright (C) 2025 IASoft (PVT) LTD (oss@iasoft.dev)
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <IAEngine/Engine.hpp>
|
||||
#include <IACore/CLI.hpp>
|
||||
|
||||
namespace ia::iae
|
||||
{
|
||||
class CLI: public ia::CLI
|
||||
{
|
||||
public:
|
||||
CLI();
|
||||
|
||||
private:
|
||||
VOID CreateNewProject(IN CONST String& name);
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user