74 lines
1.6 KiB
Rust
74 lines
1.6 KiB
Rust
use palc::Parser;
|
|
use palc::Subcommand;
|
|
use strum::EnumString;
|
|
|
|
#[derive(Parser)]
|
|
#[command(about = "SDGB api tool", long_about = env!("CARGO_PKG_DESCRIPTION"))]
|
|
pub struct Cli {
|
|
/// try to generate human readable output.
|
|
#[arg(short = 'M', long)]
|
|
pub machine_readable: bool,
|
|
#[command(subcommand)]
|
|
pub command: Commands,
|
|
}
|
|
|
|
#[derive(EnumString)]
|
|
pub enum AuthLiteVariant {
|
|
SDGB,
|
|
SDHJ,
|
|
}
|
|
|
|
#[derive(Subcommand)]
|
|
pub enum Commands {
|
|
/// Login with QRCode from wechat
|
|
QRLogin {
|
|
/// content of the qrcode, only the last 64 characters were used
|
|
#[arg(short, long)]
|
|
qrcode_content: String,
|
|
},
|
|
|
|
AuthLite {
|
|
#[arg(short, long, default_value = "1.50")]
|
|
title_ver: String,
|
|
#[arg(long, default_value = "SDGB")]
|
|
variant: AuthLiteVariant,
|
|
},
|
|
|
|
// below are login-free
|
|
Ping,
|
|
Preview {
|
|
#[arg(short, long)]
|
|
user_id: u32,
|
|
},
|
|
Rating {
|
|
#[arg(short, long)]
|
|
user_id: u32,
|
|
},
|
|
|
|
// below requires login
|
|
Userdata {
|
|
#[arg(short, long)]
|
|
user_id: u32,
|
|
},
|
|
|
|
#[cfg(feature = "fetchall")]
|
|
ListAllUser {
|
|
#[arg(short, long, default_value_t = 5)]
|
|
concurrency: usize,
|
|
},
|
|
#[cfg(feature = "fetchall")]
|
|
ListAllUserDump {},
|
|
|
|
Logout {
|
|
#[arg(short, long)]
|
|
user_id: u32,
|
|
/// Second-precision login unix timestamp, must be the same as on `login`
|
|
///
|
|
/// For official arcades, it's commonly the time `amdaemon.exe` starts
|
|
///
|
|
/// For unofficial clients, it depends.
|
|
#[arg(short, long)]
|
|
timestamp: u64,
|
|
},
|
|
}
|