summaryrefslogtreecommitdiff
path: root/kel_git/c++
diff options
context:
space:
mode:
authorClaudius "keldu" Holeksa <mail@keldu.de>2026-11-02 22:17:53 +0100
committerClaudius "keldu" Holeksa <mail@keldu.de>2026-11-02 22:17:53 +0100
commit29b7e03b93229090928d08dbcdb2622be0b27b53 (patch)
tree03948dcd591923a3fd4ae5d649615bc6b6fac810 /kel_git/c++
parent5fa5d111919d507e644bc39e1cac2439183c9c14 (diff)
downloadapps-dev_tools-29b7e03b93229090928d08dbcdb2622be0b27b53.tar.gz
Prep for kel_git stuff
Diffstat (limited to 'kel_git/c++')
-rw-r--r--kel_git/c++/SConscript32
-rw-r--r--kel_git/c++/common.hpp7
-rw-r--r--kel_git/c++/config.hpp16
-rw-r--r--kel_git/c++/git_schema.hpp10
-rw-r--r--kel_git/c++/kel_git.cpp74
5 files changed, 139 insertions, 0 deletions
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 <forstio/codec/data.hpp>
+
+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<typename CfgEnc>
+saw::error_or<void> parse_config(const saw::data<GitConfig,CfgEnc>& cfg_enc, saw::data<GitConfig>& 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 <forstio/codec/data.hpp>
+#include <forstio/codec/args.hpp>
+
+#include <iostream>
+#include <charconv>
+
+#include "common.hpp"
+#include "config.hpp"
+
+namespace kel {
+namespace sch {
+using namespace saw::schema;
+
+using GitArgs = Args<
+ Struct<
+ >,
+ Tuple<>
+>;
+}
+
+saw::error_or<void> kmain(int argc, char** argv){
+ saw::data<sch::GitArgs> args_d;
+ {
+ saw::data<sch::GitArgs, saw::encode::Args> args_data{argc, argv};
+ saw::codec<sch::GitArgs, saw::encode::Args> args_codec;
+
+ auto eov = args_codec.decode(args_data, args_d);
+ if(eov.is_error()){
+ return eov;
+ }
+ }
+ // saw::data<kel::sch::CommandConfig> 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]: "<<err.get_category();
+
+ if(not err_msg.empty()){
+ std::cerr<<" - "<<err_msg;
+ }
+ std::cerr<<std::endl;
+
+ return err.get_id();
+ }
+
+ return 0;
+}