use anyhow::Result;
use clap::Args;
use ironflow_sdk::IronflowClient;
#[derive(Debug, Args)]
pub struct DashboardArgs {
#[arg(long)]
pub print: bool,
}
pub fn execute(client: &IronflowClient, args: &DashboardArgs) -> Result<()> {
let url = client.base_url().to_string();
if args.print {
println!("{url}");
} else {
println!("Opening {url}");
open::that(&url)?;
}
Ok(())
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn dashboard_print_returns_ok() {
let client = IronflowClient::new("https://ironflow.example.com", "key");
let args = DashboardArgs { print: true };
execute(&client, &args).unwrap();
}
}