nirv_engine/cli/
cli_args.rs

1use clap::{Parser, Subcommand, ValueEnum};
2
3/// NIRV Engine CLI - Universal data virtualization and compute orchestration
4#[derive(Parser, Debug)]
5#[command(name = "nirv")]
6#[command(about = "Universal data virtualization and compute orchestration engine")]
7#[command(version = "0.1.0")]
8pub struct CliArgs {
9    #[command(subcommand)]
10    pub command: Commands,
11}
12
13/// Available CLI commands
14#[derive(Subcommand, Debug)]
15pub enum Commands {
16    /// Execute a SQL query
17    Query {
18        /// SQL query to execute
19        #[arg(value_name = "SQL")]
20        sql: String,
21        
22        /// Output format
23        #[arg(short, long, default_value = "table")]
24        format: OutputFormat,
25        
26        /// Connector configuration file
27        #[arg(short, long)]
28        config: Option<String>,
29        
30        /// Enable verbose output
31        #[arg(short, long)]
32        verbose: bool,
33    },
34    
35    /// List available data sources
36    Sources {
37        /// Show detailed information
38        #[arg(short, long)]
39        detailed: bool,
40    },
41    
42    /// Show schema information for a data source
43    Schema {
44        /// Data source identifier (e.g., "postgres.users")
45        source: String,
46    },
47}
48
49/// Output format options
50#[derive(ValueEnum, Debug, Clone)]
51pub enum OutputFormat {
52    /// Formatted table output
53    Table,
54    /// JSON output
55    Json,
56    /// CSV output
57    Csv,
58}
59
60impl std::fmt::Display for OutputFormat {
61    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
62        match self {
63            OutputFormat::Table => write!(f, "table"),
64            OutputFormat::Json => write!(f, "json"),
65            OutputFormat::Csv => write!(f, "csv"),
66        }
67    }
68}