diff --git a/src/main.rs b/src/main.rs index 426e7bf..7504300 100644 --- a/src/main.rs +++ b/src/main.rs @@ -6,38 +6,59 @@ use anyhow::Result as AResult; #[command(author, version, about, long_about = None)] #[command(propagate_version = true)] struct Cli { - #[arg(long)] - path:Option, #[command(subcommand)] command: Commands, } #[derive(Subcommand)] enum Commands { - DownloadTextures(PathBufList), - ExtractTextures(PathBufList), - ConvertTextures, - VPKContents, - BSPContents, - DownloadMeshes(PathBufList), - WriteAttributes, + DownloadTextures(DownloadTexturesSubcommand), + ExtractTextures(ExtractTexturesSubcommand), + ConvertTextures(ConvertTexturesSubcommand), + VPKContents(VPKContentsSubcommand), + BSPContents(BSPContentsSubcommand), + DownloadMeshes(DownloadMeshesSubcommand), + WriteAttributes(WriteAttributesSubcommand), } #[derive(Args)] -struct PathBufList { - paths:Vec +struct DownloadTexturesSubcommand { + roblox_files:Vec +} +#[derive(Args)] +struct ExtractTexturesSubcommand { + bsp_file:PathBuf, + vpk_dir_files:Vec +} +#[derive(Args)] +struct ConvertTexturesSubcommand { +} +#[derive(Args)] +struct VPKContentsSubcommand { + input_file:PathBuf, +} +#[derive(Args)] +struct BSPContentsSubcommand { + input_file:PathBuf, +} +#[derive(Args)] +struct DownloadMeshesSubcommand { + roblox_files:Vec +} +#[derive(Args)] +struct WriteAttributesSubcommand { } fn main() -> AResult<()> { let cli = Cli::parse(); match cli.command { - Commands::DownloadTextures(pathlist)=>download_textures(pathlist.paths), - Commands::ExtractTextures(pathlist)=>extract_textures(vec![cli.path.unwrap()],pathlist.paths), - Commands::VPKContents=>vpk_contents(cli.path.unwrap()), - Commands::BSPContents=>bsp_contents(cli.path.unwrap()), - Commands::ConvertTextures=>convert_textures(), - Commands::DownloadMeshes(pathlist)=>download_meshes(pathlist.paths), - Commands::WriteAttributes=>write_attributes(), + Commands::DownloadTextures(subcommand)=>download_textures(subcommand.roblox_files), + Commands::ExtractTextures(subcommand)=>extract_textures(vec![subcommand.bsp_file],subcommand.vpk_dir_files), + Commands::VPKContents(subcommand)=>vpk_contents(subcommand.input_file), + Commands::BSPContents(subcommand)=>bsp_contents(subcommand.input_file), + Commands::ConvertTextures(_subcommand)=>convert_textures(), + Commands::DownloadMeshes(subcommand)=>download_meshes(subcommand.roblox_files), + Commands::WriteAttributes(_subcommand)=>write_attributes(), } }