use std::{io::Read,path::PathBuf}; use clap::{Args,Parser,Subcommand}; use anyhow::Result as AResult; use futures::StreamExt; use rbx_asset::context::{RobloxContext,InventoryItem,AssetVersion}; type AssetID=u64; type AssetIDFileMap=Vec<(AssetID,PathBuf)>; const CONCURRENT_DECODE:usize=8; const CONCURRENT_REQUESTS:usize=32; #[derive(Parser)] #[command(author,version,about,long_about=None)] #[command(propagate_version = true)] struct Cli{ #[command(subcommand)] command:Commands, } #[derive(Subcommand)] enum Commands{ DownloadHistory(DownloadHistorySubcommand), Download(DownloadSubcommand), DownloadGroupInventoryJson(DownloadGroupInventoryJsonSubcommand), Create(CreateSubcommand), Upload(UploadSubcommand), Compile(CompileSubcommand), Decompile(DecompileSubcommand), DecompileHistoryIntoGit(DecompileHistoryIntoGitSubcommand), DownloadAndDecompileHistoryIntoGit(DownloadAndDecompileHistoryIntoGitSubcommand), } #[derive(Args)] struct DownloadHistorySubcommand{ #[arg(long)] asset_id:AssetID, #[arg(long)] cookie_type:CookieType, #[arg(long)] cookie:String, #[arg(long)] output_folder:Option, #[arg(long)] continue_from_versions:Option, #[arg(long)] start_version:Option, #[arg(long)] end_version:Option, } #[derive(Args)] struct DownloadSubcommand{ #[arg(long)] cookie_type:CookieType, #[arg(long)] cookie:String, #[arg(long)] output_folder:Option, #[arg(required=true)] asset_ids:Vec, } #[derive(Args)] struct DownloadGroupInventoryJsonSubcommand{ #[arg(long)] cookie_type:CookieType, #[arg(long)] cookie:String, #[arg(long)] output_folder:Option, #[arg(long)] group:u64, } #[derive(Args)] struct CreateSubcommand{ #[arg(long)] cookie_type:CookieType, #[arg(long)] cookie:String, #[arg(long)] model_name:String, #[arg(long)] description:Option, #[arg(long)] input_file:PathBuf, #[arg(long)] group:Option, #[arg(long)] free_model:Option, #[arg(long)] allow_comments:Option, } #[derive(Args)] struct UploadSubcommand{ #[arg(long)] asset_id:AssetID, #[arg(long)] cookie_type:CookieType, #[arg(long)] cookie:String, #[arg(long)] input_file:PathBuf, #[arg(long)] group:Option, } #[derive(Args)] struct CompileSubcommand{ #[arg(long)] input_folder:Option, #[arg(long)] output_file:PathBuf, #[arg(long)] style:Option