use clap::{Parser, Subcommand};
mod commands;
mod path;
mod release;
use commands::blastem;
use commands::compile_commands;
use commands::doc;
use commands::doctor;
use commands::gdb;
use commands::install;
use commands::make;
use commands::new;
use commands::open;
use commands::uninstall;
#[derive(Parser)]
#[command(name = "sgdkx")]
#[command(version = env!("CARGO_PKG_VERSION"))]
struct Cli {
#[command(subcommand)]
command: Option<Commands>,
}
#[derive(Subcommand)]
enum Commands {
Install(install::Args),
New(new::Args),
Make(make::Args),
Blastem(blastem::Args),
Gdb(gdb::Args),
#[allow(clippy::enum_variant_names)] CompileCommands(compile_commands::Args),
Doc,
Open(open::Args),
Uninstall(uninstall::Args),
}
fn main() {
let cli = Cli::parse();
match &cli.command {
Some(cmd) => match cmd {
Commands::Install(args) => install::run(args),
Commands::New(args) => new::run(args),
Commands::Make(args) => make::run(args),
Commands::Blastem(args) => blastem::run(args),
Commands::Gdb(args) => gdb::run(args),
Commands::CompileCommands(args) => compile_commands::run(args),
Commands::Doc => doc::run(),
Commands::Open(args) => open::run(args),
Commands::Uninstall(args) => uninstall::run(args),
},
None => {
use clap::CommandFactory;
let _ = Cli::command().print_help();
println!();
doctor::run();
}
}
}