ecad_processor/cli/
args.rs

1use clap::{Parser, Subcommand};
2use std::path::PathBuf;
3
4#[derive(Parser)]
5#[command(name = "ecad-processor")]
6#[command(about = "High-performance ECAD weather data processor")]
7#[command(version)]
8pub struct Cli {
9    #[command(subcommand)]
10    pub command: Commands,
11
12    #[arg(short, long, global = true, help = "Enable verbose logging")]
13    pub verbose: bool,
14
15    #[arg(long, global = true, help = "Log file path")]
16    pub log_file: Option<PathBuf>,
17}
18
19#[derive(Subcommand)]
20pub enum Commands {
21    /// Process weather data from zip archive
22    Process {
23        #[arg(short, long, help = "Input zip archive file")]
24        input_archive: PathBuf,
25
26        #[arg(
27            short,
28            long,
29            help = "Output Parquet file path [default: ecad-weather-{YYMMDD}.parquet]"
30        )]
31        output_file: Option<PathBuf>,
32
33        #[arg(short, long, default_value = "snappy")]
34        compression: String,
35
36        #[arg(short, long)]
37        station_id: Option<u32>,
38
39        #[arg(long, default_value = "false")]
40        validate_only: bool,
41
42        #[arg(long, default_value_t = num_cpus::get())]
43        max_workers: usize,
44
45        #[arg(long, default_value = "1000")]
46        chunk_size: usize,
47    },
48
49    /// Process all zip files in directory and combine into unified dataset
50    ProcessDirectory {
51        #[arg(short, long, help = "Input directory containing zip files")]
52        input_dir: PathBuf,
53
54        #[arg(
55            short,
56            long,
57            help = "Output unified Parquet file path [default: ecad-weather-unified-{YYMMDD}.parquet]"
58        )]
59        output_file: Option<PathBuf>,
60
61        #[arg(short, long, default_value = "snappy")]
62        compression: String,
63
64        #[arg(short, long)]
65        station_id: Option<u32>,
66
67        #[arg(long, default_value = "false")]
68        validate_only: bool,
69
70        #[arg(long, default_value_t = num_cpus::get())]
71        max_workers: usize,
72
73        #[arg(long, default_value = "1000")]
74        chunk_size: usize,
75
76        #[arg(
77            long,
78            help = "Filter to specific file pattern (e.g., 'UK_ALL_')",
79            default_value = ""
80        )]
81        file_pattern: String,
82    },
83
84    /// Validate archive data without processing
85    Validate {
86        #[arg(short, long, help = "Input zip archive file")]
87        input_archive: PathBuf,
88
89        #[arg(long, default_value_t = num_cpus::get())]
90        max_workers: usize,
91    },
92
93    /// Display information about a Parquet file
94    Info {
95        #[arg(short, long)]
96        file: PathBuf,
97
98        #[arg(short, long, default_value = "10")]
99        sample: usize,
100
101        #[arg(
102            long,
103            default_value = "0",
104            help = "Maximum records to analyze (0 = all records)"
105        )]
106        analysis_limit: usize,
107    },
108}