use std::path::PathBuf;
pub mod erlang;
pub mod metrics;
pub mod ui;
#[derive(Debug, Clone, clap::Subcommand)]
pub enum Command {
Run(RunArgs),
Replay(ReplayArgs),
}
#[derive(Debug, Clone, clap::Args)]
pub struct RunArgs {
pub erlang_node: erl_dist::node::NodeName,
#[clap(long, short = 'i', default_value = "1")]
pub polling_interval: std::num::NonZeroUsize,
#[clap(long, short = 'c')]
pub cookie: Option<String>,
#[clap(long, value_name = "FILE")]
pub record: Option<PathBuf>,
#[clap(long, short)]
pub port: Option<u16>,
}
impl RunArgs {
pub fn find_cookie(&self) -> anyhow::Result<String> {
if let Some(cookie) = &self.cookie {
Ok(cookie.clone())
} else {
erlang::find_cookie()
}
}
}
#[derive(Debug, Clone, clap::Args)]
pub struct ReplayArgs {
pub file: PathBuf,
}