2024-08-24 00:45:16 +02:00
|
|
|
use plan::Plan;
|
|
|
|
use project::ProjectPlan;
|
2024-08-23 23:22:35 +02:00
|
|
|
|
2024-08-24 00:45:16 +02:00
|
|
|
mod plan;
|
|
|
|
mod project;
|
2024-08-23 21:51:42 +02:00
|
|
|
|
|
|
|
#[tokio::main]
|
|
|
|
async fn main() -> anyhow::Result<()> {
|
|
|
|
dotenv::dotenv().ok();
|
|
|
|
tracing_subscriber::fmt::init();
|
|
|
|
|
2024-08-24 00:45:16 +02:00
|
|
|
let _cuddle = Cuddle::default()
|
|
|
|
.prepare_project()
|
|
|
|
.await?
|
|
|
|
.prepare_plan()
|
|
|
|
.await?;
|
2024-08-23 23:21:53 +02:00
|
|
|
|
|
|
|
Ok(())
|
|
|
|
}
|
|
|
|
|
2024-08-24 00:45:16 +02:00
|
|
|
struct Start {}
|
|
|
|
struct PrepareProject {
|
|
|
|
project: Option<ProjectPlan>,
|
|
|
|
}
|
|
|
|
|
|
|
|
struct PreparePlan {
|
|
|
|
project: Option<ProjectPlan>,
|
|
|
|
plan: Option<Plan>,
|
|
|
|
}
|
|
|
|
|
|
|
|
struct Cuddle<S = Start> {
|
|
|
|
state: S,
|
|
|
|
}
|
|
|
|
|
|
|
|
// Cuddle maintains the context for cuddle to use
|
|
|
|
// Stage 1 figure out which state to display
|
|
|
|
// Stage 2 prepare plan
|
|
|
|
// Stage 3 validate settings, build actions, prepare
|
|
|
|
impl Cuddle {}
|
|
|
|
|
|
|
|
impl Cuddle<Start> {
|
|
|
|
pub fn default() -> Self {
|
|
|
|
Self { state: Start {} }
|
|
|
|
}
|
|
|
|
|
|
|
|
pub async fn prepare_project(&self) -> anyhow::Result<Cuddle<PrepareProject>> {
|
|
|
|
let project = ProjectPlan::from_current_path().await?;
|
|
|
|
|
|
|
|
Ok(Cuddle {
|
|
|
|
state: PrepareProject { project },
|
|
|
|
})
|
|
|
|
}
|
2024-08-23 23:21:53 +02:00
|
|
|
}
|
|
|
|
|
2024-08-24 00:45:16 +02:00
|
|
|
impl Cuddle<PrepareProject> {
|
|
|
|
pub async fn prepare_plan(&self) -> anyhow::Result<Cuddle<PreparePlan>> {
|
|
|
|
if let Some(project) = &self.state.project {
|
|
|
|
match Plan::new().clone_from_project(project).await? {
|
|
|
|
Some(plan) => todo!(),
|
|
|
|
None => todo!(),
|
|
|
|
}
|
|
|
|
}
|
2024-08-23 21:51:42 +02:00
|
|
|
|
2024-08-24 00:45:16 +02:00
|
|
|
todo!()
|
2024-08-23 21:51:42 +02:00
|
|
|
}
|
2024-08-23 23:21:53 +02:00
|
|
|
}
|