use std::path::PathBuf;
use clap::Parser;
#[derive(Parser, Debug)]
#[command(
author,
version,
about = "Interactive sequence diagram viewer for SACP trace files"
)]
struct Args {
trace_file: PathBuf,
#[arg(short, long)]
port: Option<u16>,
#[arg(long)]
no_open: bool,
}
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let args = Args::parse();
if !args.trace_file.exists() {
anyhow::bail!("Trace file not found: {}", args.trace_file.display());
}
let config = sacp_trace_viewer::TraceViewerConfig {
port: args.port.unwrap_or(0),
open_browser: !args.no_open,
};
sacp_trace_viewer::serve_file(args.trace_file, config).await
}