forked from StrafesNET/asset-tool
45 lines
898 B
Rust
45 lines
898 B
Rust
|
use std::io::{Read,Seek};
|
||
|
use clap::{Args,Parser,Subcommand};
|
||
|
use anyhow::Result as AResult;
|
||
|
|
||
|
type AssetID=u64;
|
||
|
|
||
|
#[derive(Parser)]
|
||
|
#[command(author,version,about,long_about=None)]
|
||
|
#[command(propagate_version = true)]
|
||
|
struct Cli{
|
||
|
#[command(subcommand)]
|
||
|
command:Commands,
|
||
|
}
|
||
|
|
||
|
#[derive(Subcommand)]
|
||
|
enum Commands{
|
||
|
Download(AssetIDList),
|
||
|
Upload{path:std::path::PathBuf,asset_id:AssetID},
|
||
|
}
|
||
|
|
||
|
#[derive(Args)]
|
||
|
struct PathBufList{
|
||
|
paths:Vec<std::path::PathBuf>
|
||
|
}
|
||
|
|
||
|
#[derive(Args)]
|
||
|
struct AssetIDList{
|
||
|
asset_ids:Vec<AssetID>,
|
||
|
}
|
||
|
|
||
|
fn main()->AResult<()>{
|
||
|
let cli=Cli::parse();
|
||
|
match cli.command{
|
||
|
Commands::Download(asset_id_list)=>download_list(asset_id_list.asset_ids).await,
|
||
|
Commands::Upload{path,asset_id}=>upload_file(path,asset_id),
|
||
|
}
|
||
|
}
|
||
|
|
||
|
fn upload_file(_path:std::path::PathBuf,_asset_id:AssetID)->AResult<()>{
|
||
|
Ok(())
|
||
|
}
|
||
|
|
||
|
async fn download_list(_asset_ids:Vec<AssetID>)->AResult<()>{
|
||
|
Ok(())
|
||
|
}
|