use clap::{Parser, Subcommand, ValueEnum};
#[derive(Parser, Debug)]
#[command(name = "nirv")]
#[command(about = "Universal data virtualization and compute orchestration engine")]
#[command(version = "0.1.0")]
pub struct CliArgs {
#[command(subcommand)]
pub command: Commands,
}
#[derive(Subcommand, Debug)]
pub enum Commands {
Query {
#[arg(value_name = "SQL")]
sql: String,
#[arg(short, long, default_value = "table")]
format: OutputFormat,
#[arg(short, long)]
config: Option<String>,
#[arg(short, long)]
verbose: bool,
},
Sources {
#[arg(short, long)]
detailed: bool,
},
Schema {
source: String,
},
}
#[derive(ValueEnum, Debug, Clone)]
pub enum OutputFormat {
Table,
Json,
Csv,
}
impl std::fmt::Display for OutputFormat {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
OutputFormat::Table => write!(f, "table"),
OutputFormat::Json => write!(f, "json"),
OutputFormat::Csv => write!(f, "csv"),
}
}
}