// File: /Users/timurgordon/code/git.ourworld.tf/herocode/rhailib/src/monitor/cmd/main.rs use anyhow::Result; use clap::Parser; // This assumes that `rhailib/src/lib.rs` will have `pub mod monitor;` // and `rhailib/src/monitor/mod.rs` will have `pub mod cli_logic;` // and `cli_logic.rs` will contain `pub async fn start_monitoring`. // The `crate::` prefix refers to the `rhailib` crate root. #[derive(Parser, Debug)] #[clap(author, version, about = "Rhai Worker Live Monitor", long_about = None)] struct Args { /// Comma-separated list of worker names to monitor #[clap(short, long, value_delimiter = ',')] workers: Vec, } #[tokio::main] async fn main() -> Result<()> { tracing_subscriber::fmt::init(); let args = Args::parse(); if args.workers.is_empty() { eprintln!("Error: At least one worker name must be provided via --workers."); // Consider returning an Err or using clap's built-in required attributes. std::process::exit(1); } tracing::info!("Monitor CLI starting for workers: {:?}", args.workers); // Call the monitoring logic from the `cli_logic` submodule within the `monitor` module crate::monitor::cli_logic::start_monitoring(&args.workers).await?; tracing::info!("Monitor CLI finished."); Ok(()) }