Skip to content

Commit

Permalink
FLAGS BAY-BEE
Browse files Browse the repository at this point in the history
  • Loading branch information
ExtremelyRyan committed Oct 22, 2023
1 parent 06a8d60 commit 9a3afcb
Show file tree
Hide file tree
Showing 4 changed files with 93 additions and 36 deletions.
18 changes: 9 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 3.27
# Generated by "Unix Makefiles" Generator, CMake Version 3.28

# Default target executed when no arguments are given to make.
default_target: all
Expand Down Expand Up @@ -48,27 +48,27 @@ cmake_force:
SHELL = /bin/sh

# The CMake executable.
CMAKE_COMMAND = /usr/bin/cmake
CMAKE_COMMAND = /usr/local/bin/cmake

# The command to remove a file.
RM = /usr/bin/cmake -E rm -f
RM = /usr/local/bin/cmake -E rm -f

# Escaping for special characters.
EQUALS = =

# The top-level source directory on which CMake was run.
CMAKE_SOURCE_DIR = /home/deastl/repos/cmake-generator
CMAKE_SOURCE_DIR = /home/lucas/wrk/learning/cpp/cmake-generator

# The top-level build directory on which CMake was run.
CMAKE_BINARY_DIR = /home/deastl/repos/cmake-generator
CMAKE_BINARY_DIR = /home/lucas/wrk/learning/cpp/cmake-generator

#=============================================================================
# Targets provided globally by CMake.

# Special rule for the target edit_cache
edit_cache:
@$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Running CMake cache editor..."
/usr/bin/ccmake -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
/usr/local/bin/ccmake -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
.PHONY : edit_cache

# Special rule for the target edit_cache
Expand All @@ -78,7 +78,7 @@ edit_cache/fast: edit_cache
# Special rule for the target rebuild_cache
rebuild_cache:
@$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Running CMake to regenerate build system..."
/usr/bin/cmake --regenerate-during-build -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
/usr/local/bin/cmake --regenerate-during-build -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
.PHONY : rebuild_cache

# Special rule for the target rebuild_cache
Expand All @@ -87,9 +87,9 @@ rebuild_cache/fast: rebuild_cache

# The main all target
all: cmake_check_build_system
$(CMAKE_COMMAND) -E cmake_progress_start /home/deastl/repos/cmake-generator/CMakeFiles /home/deastl/repos/cmake-generator//CMakeFiles/progress.marks
$(CMAKE_COMMAND) -E cmake_progress_start /home/lucas/wrk/learning/cpp/cmake-generator/CMakeFiles /home/lucas/wrk/learning/cpp/cmake-generator//CMakeFiles/progress.marks
$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 all
$(CMAKE_COMMAND) -E cmake_progress_start /home/deastl/repos/cmake-generator/CMakeFiles 0
$(CMAKE_COMMAND) -E cmake_progress_start /home/lucas/wrk/learning/cpp/cmake-generator/CMakeFiles 0
.PHONY : all

# The main clean target
Expand Down
8 changes: 4 additions & 4 deletions src/Command/Command.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ typedef struct Context {
std::string include_dir{"include"};
std::string build_dir{"build"};
std::string project_version{"0.0.1"};
std::vector<std::string> flags;

std::vector<std::string> flags;
} Context;

bool loadPackageToml(std::shared_ptr<Context> ctx);
bool init(std::shared_ptr<Context>);
bool init(std::shared_ptr<Context>, std::vector<std::string> args);
bool run(std::shared_ptr<Context>);
bool ftp();
bool ftp(std::shared_ptr<Context>);
bool addFlag(std::shared_ptr<Context>, std::string);
bool help();

Expand Down
89 changes: 70 additions & 19 deletions src/Command/CommandInit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <fstream>
#include <iostream>
#include <string>
#include <algorithm>

namespace Command {

Expand Down Expand Up @@ -161,29 +162,79 @@ bool createCProject(std::shared_ptr<Context> ctx) {
return false;
}

bool defaultTomlCpp(std::shared_ptr<Context> ctx) {
ctx->project_name = "cppProject";

toml::array authors = toml::array{};
toml::table table = toml::table{
{"project",
toml::table{
{"cmake_version", ctx->cmake_version},
{"include_dir", ctx->include_dir},
{"project_version", ctx->project_version},
{"compiler", ctx->compiler},
{"project_name", ctx->project_name},
{"authors", authors},
{"src_dir", ctx->src_dir},
{"build_dir", ctx->build_dir},
{"lang", ctx->lang},
{"lang_version", ctx->lang_version},
}},
};
std::cout << "📄New Toml File: \n";
std::cout << table << '\n';

std::ofstream file;
file.open("./config.toml");
file << table;
file << '\n';
file.close();
}

bool init(std::shared_ptr<Context> ctx, std::vector<std::string> args)
{

bool init(std::shared_ptr<Context> ctx) {
while (true) {
std::cout << "Language: ";
std::getline(std::cin,ctx->lang);
if (ctx->lang == "cpp" || ctx->lang == "c++") {
createCppProject(ctx);
break;
} else if (ctx->lang == "c") {
createCProject(ctx);
break;
} else if (ctx->lang == "rust") {
std::cout << "Fuck off" << ENDL;
break;
} else if (ctx->lang == "java") {
std::cout << "'Are you ok? Stop it get some help' - MJ" << ENDL;
break;
} else {
std::cout << "Invalid language" << ENDL;
return 1;
if (std::find(args.begin(), args.end(), "-y") != args.end())
{
defaultTomlCpp(ctx)
loadPackageToml(ctx);
createCMakelists(ctx);
createHelloWorldCpp();
}
else
{
while (true)
{
std::cout << "Language: ";
std::getline(std::cin, ctx->lang);
if (ctx->lang == "cpp" || ctx->lang == "c++")
{
createCppProject(ctx);
break;
}
else if (ctx->lang == "c")
{
createCProject(ctx);
break;
}
else if (ctx->lang == "rust")
{
std::cout << "Fuck off" << ENDL;
break;
}
else if (ctx->lang == "java")
{
std::cout << "'Are you ok? Stop it get some help' - MJ" << ENDL;
break;
}
else
{
std::cout << "Invalid language" << ENDL;
return 1;
}
}
}

return true;
}

Expand Down
14 changes: 10 additions & 4 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,13 @@ int main(int argc, char **argv)
return 1;
}

std::string command = argv[1];
std::string command = argv[1];
std::vector<std::string> args;
for (int i = 2; i < argc; i++)
{
args.push_back(argv[i]);
}

// LUCAS MAKE SURE YOU INITIALIZE YOUR FUCKING STRUCT YOU TWAT
std::shared_ptr<Command::Context> ctx = std::make_shared<Command::Context>();

Expand All @@ -38,7 +44,7 @@ int main(int argc, char **argv)
};
// default if they accidentily pass nothing
auto selection = cmd_options::help;

auto it = table.find(command);
if (it != table.end())
{
Expand All @@ -48,8 +54,8 @@ int main(int argc, char **argv)
switch (selection)
{
case 0: // i / init
case 1:
Command::init(ctx);
case 1:
Command::init(ctx, args);
break;

case 2: // r / run
Expand Down

0 comments on commit 9a3afcb

Please sign in to comment.