rusty_monitor/
cli.rs

1//! CLI argument parsing for the Rusty Monitor.
2//!
3//! This module defines the command-line interface structure using `clap`.
4
5use clap::{Parser, Subcommand};
6use std::path::PathBuf;
7
8/// Real-time market data collection monitor for cryptocurrency exchanges.
9#[derive(Parser, Debug)]
10#[command(author, version, about, long_about = None)]
11pub struct Cli {
12    /// Path to the configuration file.
13    #[arg(
14        short,
15        long,
16        value_name = "FILE",
17        default_value = "config/monitor.toml",
18        global = true
19    )]
20    pub config: PathBuf,
21
22    /// Comma-separated list of exchanges to monitor.
23    #[arg(
24        short,
25        long,
26        value_name = "EXCHANGES",
27        value_delimiter = ',',
28        global = true
29    )]
30    pub exchanges: Option<Vec<String>>,
31
32    /// Comma-separated list of symbols to monitor.
33    #[arg(
34        short,
35        long,
36        value_name = "SYMBOLS",
37        value_delimiter = ',',
38        global = true
39    )]
40    pub symbols: Option<Vec<String>>,
41
42    /// Run the monitor as a background daemon.
43    #[arg(short, long, action = clap::ArgAction::SetTrue, global = true)]
44    pub daemon: bool,
45
46    /// The command to execute.
47    #[command(subcommand)]
48    pub command: Option<Commands>,
49}
50
51/// Defines the available subcommands.
52#[derive(Subcommand, Debug)]
53pub enum Commands {
54    /// Start the market data monitor.
55    Start(StartArgs),
56
57    /// Manage configuration files.
58    Config(ConfigArgs),
59
60    /// Show system status and statistics.
61    Status(StatusArgs),
62}
63
64/// Arguments for the `start` command.
65#[derive(Parser, Debug)]
66pub struct StartArgs {}
67
68/// Arguments for the `config` command.
69#[derive(Subcommand, Debug)]
70pub enum ConfigCommands {
71    /// Validate the configuration file.
72    Validate,
73    /// Generate a default configuration file.
74    Generate {
75        /// Output file path for the generated configuration.
76        #[arg(
77            short,
78            long,
79            value_name = "FILE",
80            default_value = "config/monitor.toml"
81        )]
82        output: PathBuf,
83    },
84}
85
86#[derive(Parser, Debug)]
87pub struct ConfigArgs {
88    #[command(subcommand)]
89    pub command: ConfigCommands,
90}
91
92/// Arguments for the `status` command.
93#[derive(Parser, Debug)]
94pub struct StatusArgs {}