Skip to main content

ralph/cli/task/args/
mutate.rs

1//! CLI arguments for task mutation transactions.
2//!
3//! Responsibilities:
4//! - Define args for structured task mutation requests.
5//! - Expose human vs JSON formatting for continuation-first mutation output.
6//!
7//! Not handled here:
8//! - JSON parsing or queue mutation execution.
9//! - Legacy single-field edit arguments.
10//!
11//! Invariants/assumptions:
12//! - Input is a JSON document that matches `TaskMutationRequest`.
13//! - Missing `--input` means read the JSON request from stdin.
14
15use clap::Args;
16use clap::ValueEnum;
17
18#[derive(ValueEnum, Clone, Copy, Debug, Eq, PartialEq)]
19pub enum TaskMutateFormatArg {
20    Text,
21    Json,
22}
23
24#[derive(Args, Clone)]
25pub struct TaskMutateArgs {
26    /// Read the mutation request from a JSON file.
27    ///
28    /// When omitted, Ralph reads the JSON request from stdin.
29    #[arg(long, value_name = "PATH")]
30    pub input: Option<String>,
31
32    /// Preview validation and conflict checks without saving queue changes.
33    #[arg(long)]
34    pub dry_run: bool,
35
36    /// Output format for the continuation report.
37    #[arg(long, value_enum, default_value_t = TaskMutateFormatArg::Text)]
38    pub format: TaskMutateFormatArg,
39}