ironflow_cli/commands/
workflow.rs1use anyhow::Result;
4use clap::{Args, Subcommand};
5use ironflow_sdk::IronflowClient;
6
7use crate::output;
8
9#[derive(Debug, Args)]
11pub struct WorkflowArgs {
12 #[command(subcommand)]
14 pub command: WorkflowCommands,
15}
16
17#[derive(Debug, Subcommand)]
19pub enum WorkflowCommands {
20 List,
22 Get {
24 name: String,
26 },
27}
28
29pub async fn execute(client: &IronflowClient, args: &WorkflowArgs, json_mode: bool) -> Result<()> {
35 match &args.command {
36 WorkflowCommands::List => {
37 let response = client.list_workflows().await?;
38 output::print_output(json_mode, &response, || {
39 output::workflows_table(&response.data)
40 })?;
41 }
42 WorkflowCommands::Get { name } => {
43 let response = client.get_workflow(name).await?;
44 output::print_output(json_mode, &response, || {
45 output::workflow_detail_table(&response.data)
46 })?;
47 }
48 }
49 Ok(())
50}