Skip to content

Commit

Permalink
fixed #89, fixed #90 fixed #91
Browse files Browse the repository at this point in the history
  • Loading branch information
DeaSTL committed Dec 27, 2023
1 parent 5e9e027 commit 1f6d481
Show file tree
Hide file tree
Showing 25 changed files with 361 additions and 408 deletions.
62 changes: 36 additions & 26 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,39 @@ BasedOnStyle : LLVM
SeparateDefinitionBlocks: Always
NamespaceIndentation: All

BinPackArguments: No
BinPackParameters: No

# Aligns consecutive function parameters
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false


# Penalty for breaking a function call after a call parameter
PenaltyBreakBeforeFirstCallParameter: 19



# # Configure new lines around different constructs
# BraceWrapping:
# AfterClass: true # New line after the opening brace of a class
# AfterControlStatement: true # New line after the opening brace of a control statement (if, for, while, ...)
# AfterEnum: true # New line after the opening brace of an enum
# AfterFunction: true # New line after the opening brace of a function
# AfterNamespace: true # New line after the opening brace of a namespace
# AfterStruct: true # New line after the opening brace of a struct
# AfterUnion: true # New line after the opening brace of a union
# BeforeCatch: true # New line before the 'catch' in try-catch blocks
# BeforeElse: true # New line before 'else' in if-else blocks
# BeforeLambdaBody: true # New line before the body of a lambda function
# ColumnLimit: 0
# AlignAfterOpenBracket: AlwaysBreak
# AllowAllParametersOfDeclarationOnNextLine: false
# BinPackArguments: false
# BinPackParameters: false
IndentWidth: 2
#ContinuationIndentWidth: 2


# BinPackArguments: No
# BinPackParameters: No
#
# # Aligns consecutive function parameters
# AlignAfterOpenBracket: true
# AlignConsecutiveAssignments: false
# AlignConsecutiveDeclarations: false
#
#
# # Penalty for breaking a function call after a call parameter




BraceWrapping:
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
BeforeCatch: false
BeforeElse: true
IndentBraces: false
BreakBeforeBraces: Custom
73 changes: 29 additions & 44 deletions include/Frate/Constants.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,22 @@ namespace Frate::Constants {
const std::string BUILD_OS = "windows32";
#elif _WIN64
const std::string BUILD_OS = "windows64";
#elif __APPLE__
const std::string BUILD_OS = "macos";
#elif __APPLE__ const std::string BUILD_OS = "macos";
#else
const std::string BUILD_OS = "unknown";
#endif

const std::string NAME = "frate";
const std::string DESCRIPTION =
"CLI utility for managing your project, a modern touch for C/C++";
"CLI utility for managing your project, a modern touch for C/C++";
const std::string PROJECT_URL = "https://github.com/frate-dev/frate";

constexpr const std::string_view FRATE_PACKAGES =
"https://github.com/frate-packages/index/releases/latest/download/"
"index.json";
"https://github.com/frate-packages/index/releases/latest/download/"
"index.json";
constexpr const std::string_view FRATE_TEMPLATES =
"https://github.com/frate-templates/templates/releases/latest/download/"
"index.json";
"https://github.com/frate-templates/templates/releases/latest/download/"
"index.json";

const std::string TEMPLATE_PATH = "template/";
const std::string TEMPLATE_CALLBACKS_PATH = "frate-callbacks/";
Expand All @@ -37,11 +36,11 @@ namespace Frate::Constants {
const std::string config_name = "config.json";
#ifdef _WIN64
const std::filesystem::path CONFIG_DIR =
std::filesystem::path(getenv("APPDATA")) / NAME;
std::filesystem::path(getenv("APPDATA")) / NAME;
const std::filesystem::path CONFIG_PATH = CONFIG_DIR / config_name;
#else
const std::filesystem::path CONFIG_DIR =
std::filesystem::path(getenv("HOME")) / ".config" / NAME;
std::filesystem::path(getenv("HOME")) / ".config" / NAME;
const std::filesystem::path CONFIG_PATH = CONFIG_DIR / config_name;
#endif

Expand All @@ -52,59 +51,45 @@ namespace Frate::Constants {
#endif

const std::string VERSION =
std::to_string(VMAJOR) + "." + std::to_string(VMINOR) + "." +
std::to_string(VPATCH)
std::to_string(VMAJOR) + "." + std::to_string(VMINOR) + "." +
std::to_string(VPATCH)
#ifdef VBUILD
// If VBUILD is defined, append it to the version string
+ "." + std::to_string(VBUILD)
// If VBUILD is defined, append it to the version string
+ "." + std::to_string(VBUILD)
#endif
;
;

const std::vector<std::string> SUPPORTED_CMAKE_VERSIONS = {
"3.0", "3.1", "3.2", "3.3", "3.4", "3.5", "3.6", "3.7",
"3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14", "3.15",
"3.16", "3.17", "3.18", "3.19", "3.20", "3.21", "3.22", "3.23",
"3.24", "3.25", "3.26", "3.27", "3.28",
"3.0", "3.1", "3.2", "3.3", "3.4", "3.5", "3.6", "3.7",
"3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14", "3.15",
"3.16", "3.17", "3.18", "3.19", "3.20", "3.21", "3.22", "3.23",
"3.24", "3.25", "3.26", "3.27", "3.28",
};

const std::vector<std::string> SUPPORTED_C_COMPILERS = {
"clang",
"gcc",
"icc",
"msvc",
"clang",
"gcc",
"icc",
"msvc",
};

const std::vector<std::string> SUPPORTED_CXX_COMPILERS = {
"clang++",
"g++",
"icpc",
"msvc",
"clang++",
"g++",
"icpc",
"msvc",
};

const std::vector<std::string> SUPPORTED_C_STANDARDS = {
"89",
"90",
"99",
"11",
"17",
"18",
"2x",
"89", "90", "99", "11", "17", "18", "2x",
};

const std::vector<std::string> SUPPORTED_CXX_STANDARDS = {
"98",
"03",
"11",
"1x",
"14",
"17",
"20",
"2x",
"23",
"98", "03", "11", "1x", "14", "17", "20", "2x", "23",
};

const std::vector<std::string> SUPPORTED_LANGUAGES = {
"c",
"cpp",
"c",
"cpp",
};
} // namespace Frate::Constants
32 changes: 14 additions & 18 deletions include/Frate/Interface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ namespace Frate::Command {
bool unlimited_args{false};
std::string docs;
std::function<bool(std::shared_ptr<Interface>)> callback{
[](std::shared_ptr<Interface> inter) -> bool {
(void)inter;
Utils::error << "This command has not been implemented yet"
<< std::endl;
return false;
}};
[](std::shared_ptr<Interface> inter) -> bool {
(void)inter;
Utils::error << "This command has not been implemented yet"
<< std::endl;
return false;
}};
bool run(std::shared_ptr<Interface> inter);
bool options(std::shared_ptr<Interface> inter);
};
Expand All @@ -45,12 +45,12 @@ namespace Frate::Command {
std::vector<std::string> positional_args{};
std::string docs;
std::function<bool(std::shared_ptr<Interface>)> callback{
[](std::shared_ptr<Interface> inter) -> bool {
(void)inter;
Utils::error << "This command has not been implemented yet"
<< std::endl;
return false;
}};
[](std::shared_ptr<Interface> inter) -> bool {
(void)inter;
Utils::error << "This command has not been implemented yet"
<< std::endl;
return false;
}};
bool implemented{true};
bool requires_project{true};
bool unlimited_args{false};
Expand All @@ -69,9 +69,7 @@ namespace Frate::Command {
int argc;
bool confirm_all{false};
bool parse();
void getHelpString(std::string name,
std::vector<Handler> &handlers,
bool is_subcommand = false);
void getHelpString(std::string name, std::vector<Handler> &handlers, bool is_subcommand = false);
void getHelpString(Handler &handler);
bool InitHeader();
bool CreateCMakelists();
Expand All @@ -84,7 +82,5 @@ namespace Frate::Command {
bool Main(std::shared_ptr<Interface> inter);
};

bool runCommand(std::shared_ptr<Interface> inter,
std::string command,
std::vector<Handler> &handlers);
bool runCommand(std::shared_ptr<Interface> inter, std::string command, std::vector<Handler> &handlers);
} // namespace Frate::Command
6 changes: 4 additions & 2 deletions include/Frate/Project.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ namespace Frate::Command {
using nlohmann::json;

class Project {

public:
Project();
bool loaded_json{false};
std::string name;
std::string description;
std::string type{""};
Expand All @@ -38,8 +40,8 @@ namespace Frate::Command {
std::string build_command{"cmake --build ."};
std::string test_command{"ctest"};
std::string run_command{"./bin/"};
std::vector<Mode> modes{
Mode("Release", {"-O2"}), Mode("Debug", {"-g"}), Mode("Test", {"-g"})};
std::vector<Mode> modes{Mode("Release", {"-O2"}), Mode("Debug", {"-g"}),
Mode("Test", {"-g"})};
std::vector<std::string> authors{};
std::vector<std::string> keywords{};
std::string src_dir{"src"};
Expand Down
Loading

0 comments on commit 1f6d481

Please sign in to comment.