summaryrefslogtreecommitdiff
path: root/src/main.rs
blob: 6852e55f9f00ebe437f0d99448460dca6fd761d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
mod cgit_helper;
mod git_tools;
mod pgp_tools;
mod read_config;

#[cfg(test)]
mod test;

use core::panic;
use git_tools::make_repo;
use read_config::{get_config, Config};
use serde::Deserialize;
#[derive(Debug, Deserialize)]
struct MakeRepoRequest {
    repo_name: String,
    author: String,
    section: String,
    description: String,
}
fn make_repo_request_handler(config: Config, req: MakeRepoRequest) {
    println!("Hello, world!");
    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"),
    };
}
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(),
    });
}