This commit is contained in:
Quaternions 2023-12-30 17:43:22 -08:00
parent 0a41d25270
commit d71d583d8f

@ -1,45 +1,45 @@
use std::io::{Read, Seek}; use std::io::{Read,Seek};
use clap::{Args, Parser, Subcommand}; use clap::{Args,Parser,Subcommand};
use anyhow::Result as AResult; use anyhow::Result as AResult;
type AssetID=u64; type AssetID=u64;
#[derive(Parser)] #[derive(Parser)]
#[command(author, version, about, long_about = None)] #[command(author,version,about,long_about=None)]
#[command(propagate_version = true)] #[command(propagate_version = true)]
struct Cli { struct Cli{
#[command(subcommand)] #[command(subcommand)]
command: Commands, command:Commands,
} }
#[derive(Subcommand)] #[derive(Subcommand)]
enum Commands { enum Commands{
Download(AssetIDList), Download(AssetIDList),
Upload{path:std::path::PathBuf,assetid:u64}, Upload{path:std::path::PathBuf,asset_id:u64},
} }
#[derive(Args)] #[derive(Args)]
struct PathBufList { struct PathBufList{
paths:Vec<std::path::PathBuf> paths:Vec<std::path::PathBuf>
} }
#[derive(Args)] #[derive(Args)]
struct AssetIDList { struct AssetIDList{
assetids: Vec<AssetID>, asset_ids:Vec<AssetID>,
} }
fn main() -> AResult<()> { fn main()->AResult<()>{
let cli = Cli::parse(); let cli=Cli::parse();
match cli.command { match cli.command{
Commands::Download(assetid_list)=>download_list(assetid_list.assetids), Commands::Download(asset_id_list)=>download_list(asset_id_list.asset_ids).await,
Commands::Upload{path,assetid}=>upload_file(path,assetid), Commands::Upload{path,asset_id}=>upload_file(path,asset_id),
} }
} }
fn upload_file(path:std::path::PathBuf,assetid:u64)->AResult<()>{ fn upload_file(path:std::path::PathBuf,asset_id:u64)->AResult<()>{
Ok(()) Ok(())
} }
fn download_list(assetids:Vec<AssetID>)->AResult<()>{ async fn download_list(asset_ids:Vec<AssetID>)->AResult<()>{
Ok(()) Ok(())
} }