openapi_nexus_config/
cli.rs

1//! Command-line argument definitions
2
3use clap::Parser;
4
5use crate::global_config::GlobalConfig;
6use crate::typescript_config::TypeScriptConfig;
7
8/// Command-line arguments with environment variable support
9#[derive(Debug, Parser)]
10#[command(name = "openapi-nexus")]
11#[command(about = "Generate code from OpenAPI 3.1 specifications")]
12#[command(version)]
13pub struct CliArgs {
14    #[command(subcommand)]
15    pub command: Commands,
16}
17
18#[derive(Debug, Parser)]
19pub enum Commands {
20    /// Generate code from an OpenAPI specification
21    Generate {
22        /// Path to configuration file (overrides auto-discovery)
23        #[arg(long, env = "OPENAPI_NEXUS_CONFIG")]
24        config: Option<String>,
25
26        /// Verbose output (command line only)
27        #[arg(short, long)]
28        verbose: bool,
29
30        /// Global configuration options
31        #[command(flatten)]
32        global: GlobalConfig,
33
34        /// TypeScript configuration options
35        #[command(flatten)]
36        typescript: TypeScriptConfig,
37    },
38}