1mod command;
2mod util;
3
4use clap::Parser;
5
6const LONG_VERSION: &str = concat!(env!("CARGO_PKG_VERSION"), " ", "(", env!("GIT_REV"), ")");
7
8#[derive(Debug, Parser)]
9#[command(
10 about = "A CLI tool with utilities to make interacting with RPGMaker MV games easier",
11 long_about = None,
12 long_version = LONG_VERSION
13)]
14struct Options {
15 #[command(subcommand)]
16 subcommand: SubCommand,
17}
18
19#[derive(Debug, clap::Subcommand)]
20enum SubCommand {
21 Decrypt(self::command::decrypt::Options),
22 #[command(name = "commands2py")]
23 Commands2Py(self::command::commands2py::Options),
24 EncryptPng(self::command::encrypt_png::Options),
25 GenerateCompletions(self::command::generate_completions::Options),
26 CheckLineSize(self::command::check_line_size::Options),
27}
28
29fn main() -> anyhow::Result<()> {
30 let options = Options::parse();
31
32 match options.subcommand {
33 SubCommand::Decrypt(options) => self::command::decrypt::exec(options)?,
34 SubCommand::Commands2Py(options) => self::command::commands2py::exec(options)?,
35 SubCommand::EncryptPng(options) => self::command::encrypt_png::exec(options)?,
36 SubCommand::GenerateCompletions(options) => {
37 self::command::generate_completions::exec(options)?
38 }
39 SubCommand::CheckLineSize(options) => self::command::check_line_size::exec(options)?,
40 }
41
42 Ok(())
43}