ironflow_cli/commands/
dashboard.rs1use anyhow::Result;
4use clap::Args;
5use ironflow_sdk::IronflowClient;
6
7#[derive(Debug, Args)]
9pub struct DashboardArgs {
10 #[arg(long)]
12 pub print: bool,
13}
14
15pub fn execute(client: &IronflowClient, args: &DashboardArgs) -> Result<()> {
24 let url = client.base_url().to_string();
25
26 if args.print {
27 println!("{url}");
28 } else {
29 println!("Opening {url}");
30 open::that(&url)?;
31 }
32
33 Ok(())
34}
35
36#[cfg(test)]
37mod tests {
38 use super::*;
39
40 #[test]
41 fn dashboard_print_returns_ok() {
42 let client = IronflowClient::new("https://ironflow.example.com", "key");
43 let args = DashboardArgs { print: true };
44 execute(&client, &args).unwrap();
45 }
46}