Skip to main content

ralph/cli/queue/export/
args.rs

1//! Clap arguments for `ralph queue export`.
2//!
3//! Responsibilities:
4//! - Define the user-facing flags and help text for queue export.
5//! - Keep argument parsing concerns separate from queue loading and rendering.
6//! - Preserve the public CLI contract for export workflows.
7//!
8//! Not handled here:
9//! - Export execution logic.
10//! - Task filtering or format rendering.
11//!
12//! Invariants/assumptions:
13//! - Defaults match the existing CLI surface.
14//! - Help examples stay aligned with supported output formats and filters.
15
16use std::path::PathBuf;
17
18use clap::Args;
19
20use crate::cli::queue::{QueueExportFormat, StatusArg};
21
22/// Arguments for `ralph queue export`.
23#[derive(Args)]
24#[command(
25    after_long_help = "Examples:\n  ralph queue export\n  ralph queue export --format csv --output tasks.csv\n  ralph queue export --format json --status done\n  ralph queue export --format tsv --tag rust --tag cli\n  ralph queue export --include-archive --format csv\n  ralph queue export --format csv --created-after 2026-01-01\n  ralph queue export --format md --status todo\n  ralph queue export --format gh --status doing"
26)]
27pub struct QueueExportArgs {
28    /// Output format.
29    #[arg(long, value_enum, default_value_t = QueueExportFormat::Csv)]
30    pub format: QueueExportFormat,
31
32    /// Output file path (default: stdout).
33    #[arg(long, short)]
34    pub output: Option<PathBuf>,
35
36    /// Filter by status (repeatable).
37    #[arg(long, value_enum)]
38    pub status: Vec<StatusArg>,
39
40    /// Filter by tag (repeatable, case-insensitive).
41    #[arg(long)]
42    pub tag: Vec<String>,
43
44    /// Filter by scope token (repeatable, case-insensitive; substring match).
45    #[arg(long)]
46    pub scope: Vec<String>,
47
48    /// Filter by task ID pattern (substring match).
49    #[arg(long)]
50    pub id_pattern: Option<String>,
51
52    /// Filter tasks created after this date (RFC3339 or YYYY-MM-DD).
53    #[arg(long)]
54    pub created_after: Option<String>,
55
56    /// Filter tasks created before this date (RFC3339 or YYYY-MM-DD).
57    #[arg(long)]
58    pub created_before: Option<String>,
59
60    /// Include tasks from .ralph/done.jsonc archive.
61    #[arg(long)]
62    pub include_archive: bool,
63
64    /// Only export tasks from .ralph/done.jsonc (ignores active queue).
65    #[arg(long)]
66    pub only_archive: bool,
67
68    /// Suppress size warning output.
69    #[arg(long, short)]
70    pub quiet: bool,
71}