vika_cli/
cli.rs

1use clap::{Parser, Subcommand};
2
3#[derive(Parser)]
4#[command(name = "vika-cli")]
5#[command(version = "0.1.0")]
6#[command(about = "Generate TypeScript clients from Swagger/OpenAPI specs")]
7pub struct Cli {
8    #[command(subcommand)]
9    pub command: Commands,
10}
11
12#[derive(Subcommand)]
13pub enum Commands {
14    /// Initialize a new vika-cli project
15    Init,
16    /// Generate TypeScript code from Swagger spec
17    Generate {
18        /// Path or URL to Swagger/OpenAPI spec
19        #[arg(short, long)]
20        spec: Option<String>,
21        /// Enable verbose output
22        #[arg(long)]
23        verbose: bool,
24        /// Use cached spec if available (overrides config)
25        #[arg(long, action = clap::ArgAction::SetTrue)]
26        cache: bool,
27        /// Create backup before writing files (overrides config)
28        #[arg(long, action = clap::ArgAction::SetTrue)]
29        backup: bool,
30        /// Force overwrite user-modified files (overrides config)
31        #[arg(long, action = clap::ArgAction::SetTrue)]
32        force: bool,
33    },
34    /// Update existing generated code
35    Update,
36    /// Inspect OpenAPI spec without generating code
37    Inspect {
38        /// Path or URL to Swagger/OpenAPI spec
39        #[arg(short, long)]
40        spec: Option<String>,
41        /// Show details for specific module
42        #[arg(short, long)]
43        module: Option<String>,
44        /// Show schema details
45        #[arg(long)]
46        schemas: bool,
47        /// Show dependency graph
48        #[arg(long)]
49        graph: bool,
50        /// Output as JSON
51        #[arg(long)]
52        json: bool,
53    },
54}