Skip to main content

warcraft_rs/
cli.rs

1//! Root CLI structure for warcraft-rs
2
3use clap::{Parser, Subcommand};
4
5#[derive(Parser)]
6#[command(name = "warcraft-rs")]
7#[command(about = "Command-line tools for World of Warcraft file formats", long_about = None)]
8#[command(version)]
9#[command(author)]
10pub struct Cli {
11    /// Subcommand to execute
12    #[command(subcommand)]
13    pub command: Commands,
14
15    /// Verbosity level (can be repeated for more detail)
16    #[arg(short, long, action = clap::ArgAction::Count, global = true)]
17    pub verbose: u8,
18
19    /// Suppress all output except errors
20    #[arg(short, long, global = true)]
21    pub quiet: bool,
22}
23
24#[derive(Subcommand)]
25pub enum Commands {
26    /// MPQ archive operations
27    #[cfg(feature = "mpq")]
28    Mpq {
29        #[command(subcommand)]
30        command: crate::commands::mpq::MpqCommands,
31    },
32
33    /// DBC database operations
34    #[cfg(feature = "dbc")]
35    Dbc {
36        #[command(subcommand)]
37        command: crate::commands::dbc::DbcCommands,
38    },
39
40    /// DBD (Database Definition) operations
41    #[cfg(feature = "dbc")]
42    Dbd {
43        #[command(subcommand)]
44        command: crate::commands::dbd::DbdCommand,
45    },
46
47    /// BLP texture operations
48    #[cfg(feature = "blp")]
49    Blp {
50        #[command(subcommand)]
51        command: crate::commands::blp::BlpCommands,
52    },
53
54    /// M2 model operations
55    #[cfg(feature = "m2")]
56    M2 {
57        #[command(subcommand)]
58        command: crate::commands::m2::M2Commands,
59    },
60
61    /// WMO object operations
62    #[cfg(feature = "wmo")]
63    Wmo {
64        #[command(subcommand)]
65        command: crate::commands::wmo::WmoCommands,
66    },
67
68    /// ADT terrain operations
69    #[cfg(feature = "adt")]
70    Adt {
71        #[command(subcommand)]
72        command: crate::commands::adt::AdtCommands,
73    },
74
75    /// WDT map operations
76    #[cfg(feature = "wdt")]
77    Wdt {
78        #[command(subcommand)]
79        command: crate::commands::wdt::WdtCommands,
80    },
81
82    /// WDL world operations
83    #[cfg(feature = "wdl")]
84    Wdl {
85        #[command(subcommand)]
86        command: crate::commands::wdl::WdlCommands,
87    },
88
89    /// Generate shell completions
90    Completions {
91        /// Shell to generate completions for
92        #[arg(value_enum)]
93        shell: clap_complete::Shell,
94    },
95}