mod cmd; use clap::{Parser, Subcommand}; #[derive(Parser)] #[clap(name = "Minecraft server management tool", author, version, about = "Bit Goblin's Minecraft server management tool.", long_about = None)] #[clap(propagate_version = true)] struct Cli { #[clap(subcommand)] command: Commands, } #[derive(Subcommand)] enum Commands { // new server subcommand #[clap(name = "new", about = "Create a new Minecraft java edition server instance.")] New { #[clap(short = 'n', long, required = true, help = "[REQUIRED] The name for your new server")] server_name: String, #[clap(short = 'm', long, required = true, help = "[REQUIRED] Minecraft Java Edition server version to use.")] minecraft_version: String, }, } fn main() { // start the Clap CLI let cli = Cli::parse(); // map subcommands back to the main command let res = match &cli.command { Commands::New { server_name, minecraft_version } => cmd::new::new_command(&server_name, &minecraft_version), }; match res { Ok(_) => {}, Err(e) => panic!("MCST ran into an error: {}", e), }; }