with executors WIP

This commit is contained in:
Kasper Juul Hermansen 2022-11-22 13:37:10 +01:00
parent 30d9410e9f
commit b7a0e0b96e
Signed by: kjuulh
GPG Key ID: 57B6E1465221F912
7 changed files with 40 additions and 1 deletions

View File

@ -47,9 +47,13 @@ pub async fn execute_subcommand(args: &ArgMatches) -> eyre::Result<()> {
repo_clones.push(tokio::spawn(async move { gp.clone_from_url(repo).await }));
}
let mut paths = Vec::new();
for repo_clone in repo_clones {
let report = repo_clone.await??;
let path = repo_clone.await??;
paths.push(path);
}
kk
}
}

View File

@ -0,0 +1,18 @@
use async_trait::async_trait;
use crate::schema::models::Action;
use super::executor::Executor;
pub struct DefaultExecutor;
#[async_trait]
impl Executor for DefaultExecutor {
async fn execute(&self, action: Action) -> eyre::Result<()> {
match action {
Action::Go { entry } => todo!(),
}
Ok(())
}
}

View File

@ -0,0 +1,12 @@
use std::sync::Arc;
use async_trait::async_trait;
use crate::schema::models::Action;
#[async_trait]
pub trait Executor {
async fn execute(&self, action: Action) -> eyre::Result<()>;
}
pub type DynExecutor = Arc<dyn Executor + Send + Sync>;

View File

@ -0,0 +1 @@
pub mod golang;

View File

@ -0,0 +1,3 @@
pub mod default_executor;
pub mod executor;
mod executors;

View File

@ -1,3 +1,4 @@
pub mod git;
pub mod storage;
pub mod schema;
pub mod executor;