pub mod dto;
pub mod list;
pub mod report;
pub mod show;
use std::path::PathBuf;
use clap::Subcommand;
use crate::error::CliError;
use crate::output::OutputSpec;
#[derive(Subcommand, Debug)]
pub enum NodeAction {
List {
run_id: String,
#[arg(long)]
status: Option<String>,
},
Show { run_id: String, node_id: String },
Report {
run_id: String,
node_id: String,
#[arg(long)]
from_file: PathBuf,
#[arg(long)]
idempotency_key: Option<String>,
#[arg(long)]
dry_run: bool,
},
}
pub fn dispatch(
action: NodeAction,
spec: &OutputSpec,
warnings: &[String],
) -> Result<(), CliError> {
match action {
NodeAction::List { run_id, status } => list::run(list::Args {
run_id,
status,
spec,
warnings,
}),
NodeAction::Show { run_id, node_id } => show::run(&run_id, &node_id, spec, warnings),
NodeAction::Report {
run_id,
node_id,
from_file,
idempotency_key,
dry_run,
} => report::run(report::Args {
run_id,
node_id,
from_file,
idempotency_key,
dry_run,
spec,
warnings,
}),
}
}