This commit is contained in:
Quaternions 2024-07-02 14:31:27 -07:00
parent 7e4f96a19c
commit cc7e445498

View File

@ -23,8 +23,8 @@ enum Commands{
Download(DownloadSubcommand), Download(DownloadSubcommand),
DownloadDecompile(DownloadDecompileSubcommand), DownloadDecompile(DownloadDecompileSubcommand),
DownloadGroupInventoryJson(DownloadGroupInventoryJsonSubcommand), DownloadGroupInventoryJson(DownloadGroupInventoryJsonSubcommand),
Create(CreateSubcommand), CreateAsset(CreateAssetSubcommand),
Upload(UploadSubcommand), UploadAsset(UpdateAssetSubcommand),
Compile(CompileSubcommand), Compile(CompileSubcommand),
CompileUpload(CompileUploadSubcommand), CompileUpload(CompileUploadSubcommand),
Decompile(DecompileSubcommand), Decompile(DecompileSubcommand),
@ -72,7 +72,7 @@ struct DownloadGroupInventoryJsonSubcommand{
group:u64, group:u64,
} }
#[derive(Args)] #[derive(Args)]
struct CreateSubcommand{ struct CreateAssetSubcommand{
#[arg(long)] #[arg(long)]
cookie_type:CookieType, cookie_type:CookieType,
#[arg(long)] #[arg(long)]
@ -91,7 +91,7 @@ struct CreateSubcommand{
allow_comments:Option<bool>, allow_comments:Option<bool>,
} }
#[derive(Args)] #[derive(Args)]
struct UploadSubcommand{ struct UpdateAssetSubcommand{
#[arg(long)] #[arg(long)]
asset_id:AssetID, asset_id:AssetID,
#[arg(long)] #[arg(long)]
@ -100,8 +100,6 @@ struct UploadSubcommand{
cookie:String, cookie:String,
#[arg(long)] #[arg(long)]
input_file:PathBuf, input_file:PathBuf,
#[arg(long)]
group:Option<u64>,
} }
#[derive(Args)] #[derive(Args)]
struct CompileSubcommand{ struct CompileSubcommand{
@ -211,9 +209,12 @@ struct DownloadAndDecompileHistoryIntoGitSubcommand{
} }
#[derive(Clone,clap::ValueEnum)] #[derive(Clone,clap::ValueEnum)]
enum CookieType{ enum ApiKeyLocation{
///String literal
Literal, Literal,
///Read an environment variable
Environment, Environment,
///Read a file
File, File,
} }
@ -272,7 +273,7 @@ async fn main()->AResult<()>{
subcommand.group, subcommand.group,
subcommand.output_folder.unwrap_or_else(||std::env::current_dir().unwrap()), subcommand.output_folder.unwrap_or_else(||std::env::current_dir().unwrap()),
).await, ).await,
Commands::Create(subcommand)=>create(CreateConfig{ Commands::CreateAsset(subcommand)=>create(CreateConfig{
cookie:Cookie::from_type(subcommand.cookie_type,subcommand.cookie).await?.0, cookie:Cookie::from_type(subcommand.cookie_type,subcommand.cookie).await?.0,
group:subcommand.group, group:subcommand.group,
input_file:subcommand.input_file, input_file:subcommand.input_file,
@ -281,9 +282,8 @@ async fn main()->AResult<()>{
free_model:subcommand.free_model.unwrap_or(false), free_model:subcommand.free_model.unwrap_or(false),
allow_comments:subcommand.allow_comments.unwrap_or(false), allow_comments:subcommand.allow_comments.unwrap_or(false),
}).await, }).await,
Commands::Upload(subcommand)=>upload_list( Commands::UploadAsset(subcommand)=>upload_list(
Cookie::from_type(subcommand.cookie_type,subcommand.cookie).await?.0, Cookie::from_type(subcommand.cookie_type,subcommand.cookie).await?.0,
subcommand.group,
vec![(subcommand.asset_id,subcommand.input_file)] vec![(subcommand.asset_id,subcommand.input_file)]
).await, ).await,
Commands::Compile(subcommand)=>compile(CompileConfig{ Commands::Compile(subcommand)=>compile(CompileConfig{