From 29b7e03b93229090928d08dbcdb2622be0b27b53 Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Mon, 2 Nov 2026 22:17:53 +0100 Subject: Prep for kel_git stuff --- kel_git/c++/SConscript | 32 ++++++++++++++++++++ kel_git/c++/common.hpp | 7 +++++ kel_git/c++/config.hpp | 16 ++++++++++ kel_git/c++/git_schema.hpp | 10 +++++++ kel_git/c++/kel_git.cpp | 74 ++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 139 insertions(+) create mode 100644 kel_git/c++/SConscript create mode 100644 kel_git/c++/common.hpp create mode 100644 kel_git/c++/config.hpp create mode 100644 kel_git/c++/git_schema.hpp create mode 100644 kel_git/c++/kel_git.cpp (limited to 'kel_git/c++') diff --git a/kel_git/c++/SConscript b/kel_git/c++/SConscript new file mode 100644 index 0000000..da43c01 --- /dev/null +++ b/kel_git/c++/SConscript @@ -0,0 +1,32 @@ +#!/bin/false + +import os +import os.path +import glob + + +Import('env') + +dir_path = Dir('.').abspath + +# Environment for base library +program_env = env.Clone(); + +program_env.sources = sorted(glob.glob(dir_path + "/*.cpp")) +program_env.headers = sorted(glob.glob(dir_path + "/*.hpp")) + +env.sources += program_env.sources; +env.headers += program_env.headers; + +## Static lib +objects_static = [] +program_env.add_source_files(objects_static, program_env.sources, shared=False); +env.binary = program_env.Program('#build/kel_git', [objects_static]); + +# Set Alias +env.Alias('binary', [env.binary]); + +env.targets += ['binary']; + +# Install +env.Install('$prefix/bin/', [env.binary]); diff --git a/kel_git/c++/common.hpp b/kel_git/c++/common.hpp new file mode 100644 index 0000000..79e3bbb --- /dev/null +++ b/kel_git/c++/common.hpp @@ -0,0 +1,7 @@ +#pragma once + +#include + +namespace kel { + +} diff --git a/kel_git/c++/config.hpp b/kel_git/c++/config.hpp new file mode 100644 index 0000000..3f98d3b --- /dev/null +++ b/kel_git/c++/config.hpp @@ -0,0 +1,16 @@ +#pragma once + +#include "common.hpp" + +namespace kel { +namespace sch { +using GitConfig = Struct< + Member< +>; +} + +template +saw::error_or parse_config(const saw::data& cfg_enc, saw::data& cfg){ + return saw::make_void(); +} +} diff --git a/kel_git/c++/git_schema.hpp b/kel_git/c++/git_schema.hpp new file mode 100644 index 0000000..4f06f36 --- /dev/null +++ b/kel_git/c++/git_schema.hpp @@ -0,0 +1,10 @@ +#pragma once + +#include "common.hpp" + +namespace kel { +namespace sch { +using namespace saw::schema; + +} +} diff --git a/kel_git/c++/kel_git.cpp b/kel_git/c++/kel_git.cpp new file mode 100644 index 0000000..65d7cad --- /dev/null +++ b/kel_git/c++/kel_git.cpp @@ -0,0 +1,74 @@ +#include +#include + +#include +#include + +#include "common.hpp" +#include "config.hpp" + +namespace kel { +namespace sch { +using namespace saw::schema; + +using GitArgs = Args< + Struct< + >, + Tuple<> +>; +} + +saw::error_or kmain(int argc, char** argv){ + saw::data args_d; + { + saw::data args_data{argc, argv}; + saw::codec args_codec; + + auto eov = args_codec.decode(args_data, args_d); + if(eov.is_error()){ + return eov; + } + } + // saw::data cmd_data; + { + // Parse from file + } + + bool running = true; + + auto eo_aio = saw::setup_async_io(); + if(eo_aio.is_error()){ + return std::move(eo_aio.get_error()); + } + auto& aio = eo_aio.get_value(); + auto term_sink = aio.event_port.on_signal(saw::Signal::Terminate).then([&running](){ + running = false; + }).sink(); + + + + while(running){ + aio.event_port.wait(); + } + + return saw::make_void(); +} +} + +int main(int argc, char** argv){ + auto eov = kel::kmain(argc, argv); + if(eov.is_error()){ + auto& err = eov.get_error(); + auto err_msg = err.get_message(); + std::cerr<<"[Error]: "<