Template
Initial commit
This commit is contained in:
commit
d1890b6e18
16 files changed
+702
No files matched your search
@@ -0,0 +1,29 @@
|
||||
#include <core-library/views/command-line-args-view.h>
|
||||
|
||||
#include <filesystem>
|
||||
#include <print>
|
||||
|
||||
void print_help(std::filesystem::path application_path)
|
||||
{
|
||||
std::println("Usage: {}", application_path.stem().string());
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
core::command_line_args_view command_line_args_view{argc, argv};
|
||||
|
||||
char help_option_name[]{"--help"};
|
||||
char* fallback_argv[]{argv[0], help_option_name};
|
||||
|
||||
if (std::ranges::empty(command_line_args_view))
|
||||
command_line_args_view = core::command_line_args_view(2, fallback_argv);
|
||||
|
||||
for (auto&& arg : command_line_args_view)
|
||||
{
|
||||
arg.with("--help", [&] {
|
||||
print_help(command_line_args_view.appliation_path());
|
||||
});
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
project "cpp-application"
|
||||
do
|
||||
kind "ConsoleApp"
|
||||
location "%{_MAIN_SCRIPT_DIR}/.build"
|
||||
externalincludedirs {"%{_MAIN_SCRIPT_DIR}"}
|
||||
files {
|
||||
"**.cpp",
|
||||
"**.h",
|
||||
}
|
||||
links {
|
||||
"cpp-core-library",
|
||||
}
|
||||
end
|
||||
Reference in new issue
Block a user