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