clankers-cli 0.1.6

Command-line interface for clankeRS
Documentation
use anyhow::Result;
use clankers_data::{Replay, ReplayResult};

pub async fn execute(file: &str, node: Option<&str>) -> Result<()> {
    if node.is_some() {
        // Don't pretend: replaying through an external node binary is not
        // implemented yet. In-process replay through node code is available
        // via #[clankers::replay_test] (see clankers-testing).
        eprintln!(
            "warning: --node is not implemented yet and is ignored; replaying without a node. \
             Use #[clankers::replay_test] to run replays through your node code."
        );
    }

    let replay = Replay::from_mcap(file).map_err(|e| anyhow::anyhow!("{e}"))?;
    let result = replay
        .run(|_msg| async { Ok(()) })
        .await
        .map_err(|e| anyhow::anyhow!("{e}"))?;

    print_summary(&result);
    Ok(())
}

fn print_summary(result: &ReplayResult) {
    println!("{}", clankers_data::Replay::format_summary(result));
}