Make cli async so running the graph works, add schema generation to readme
Some checks failed
test / test (push) Failing after 47m44s

This commit is contained in:
2025-12-17 17:09:05 +10:30
parent 3d4f327b66
commit 4da6d64988
3 changed files with 21 additions and 12 deletions

View File

@@ -7,7 +7,7 @@ use std::{
use std::io::Write;
use clap::{command, Parser};
use clap::Parser;
pub use commands::Commands;
@@ -23,17 +23,17 @@ use crate::{
mod commands;
#[derive(Parser)]
#[command(name = "coster-rs")]
#[command(author = "Pivato M. <mpivato4@gmail.com>")]
#[command(name = "ingey")]
#[command(author = "Pivato M. <contact@michaelpivato.dev>")]
#[command(version = "0.0.1")]
#[command(about = "Simple, fast, efficient costing tool", long_about = None)]
#[command(about = "Simple, fast, efficient data manipulation tool", long_about = None)]
pub struct Cli {
#[clap(subcommand)]
pub command: Commands,
}
impl Cli {
pub fn run(self) -> anyhow::Result<()> {
pub async fn run(self) -> anyhow::Result<()> {
match self.command {
Commands::MoveMoney {
rules,
@@ -174,11 +174,13 @@ impl Cli {
let reader = BufReader::new(file);
let graph = serde_json::from_reader(reader)?;
let graph = RunnableGraph::from_graph(graph);
// TODO: Possible to await here? Actually needs awaiting to work
graph.run_default_tasks(threads, |id, status| {
info!("Node with id {} finished with status {:?}", id, status)
});
Ok(())
let result = graph
.run_default_tasks(threads, |id, status| {
info!("Node with id {} finished with status {:?}", id, status)
})
.await;
result
}
Commands::GenerateSchema { output } => {
let schema = schema_for!(Graph);