diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main.rs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs index 8c82ed1..48d1772 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,4 +1,15 @@ +#[macro_use] +extern crate dotenv_codegen; + use clap::Parser; +use gitlab::api::{projects, Query}; +use gitlab::Gitlab; +use serde::Deserialize; + +#[derive(Debug, Deserialize)] +struct Project { + http_url_to_repo: String, +} /// Create a mirror of a repository #[derive(Parser, Debug)] @@ -13,7 +24,22 @@ struct Args { url: String, } +/* Get project info from Gitlab */ +fn get_project(url: &str) -> Project { + let gl_client = Gitlab::new(dotenv!("GITLAB_URL"), dotenv!("GITLAB_TOKEN")).unwrap(); + + let gl_endpoint = projects::Project::builder().project(url).build().unwrap(); + let gl_project: Project = gl_endpoint.query(&gl_client).unwrap(); + + gl_project +} + fn main() { + dotenv::dotenv().ok(); + let args = Args::parse(); println!("{:?}", args); + + let project = get_project(&args.url); + dbg!(project); } |