summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs38
1 files changed, 24 insertions, 14 deletions
diff --git a/src/main.rs b/src/main.rs
index baa8c8b..6852e55 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,31 +1,41 @@
-use core::panic;
mod cgit_helper;
mod git_tools;
+mod pgp_tools;
mod read_config;
-use cgit_helper::cgit_add_repo;
+
+#[cfg(test)]
+mod test;
+
+use core::panic;
use git_tools::make_repo;
use read_config::{get_config, Config};
use serde::Deserialize;
-use warp::Filter;
#[derive(Debug, Deserialize)]
struct MakeRepoRequest {
repo_name: String,
author: String,
- sig_text: String,
+ section: String,
+ description: String,
}
-fn make_repo_request_handler(config: Config) {
+fn make_repo_request_handler(config: Config, req: MakeRepoRequest) {
println!("Hello, world!");
- let _repository = match make_repo("any_test.git", "z.liu@outlook.com.gr") {
+ let _repository = match make_repo(
+ &req.repo_name,
+ &req.author,
+ &req.section,
+ &req.description,
+ config,
+ ) {
Ok(repo) => repo,
Err(_e) => panic!("Something went wrong during repo init"),
};
- let section_name = String::from("custom");
- cgit_add_repo(config.cgitrepos_file_path, section_name);
}
-#[tokio::main]
-async fn main() {
- let _config: Config = get_config("./config.local.json".to_string());
- let ping = warp::path!("ping").map(|| "pong");
- warp::serve(ping).run(([127, 0, 0, 1], 7070)).await;
- //make_repo_request_handler(config);
+fn main() {
+ let config: Config = get_config("./config.local.json".to_string());
+ make_repo_request_handler(config, MakeRepoRequest {
+ repo_name: "hello-world".to_string(),
+ author: "joe mama".to_string(),
+ section: "skibidi".to_string(),
+ description: "foo bar".to_string(),
+ });
}