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, }, /// Retrieve update package of SDGB AuthLite { #[arg(short, long, default_value = "1.50")] title_ver: String, #[arg(long, default_value = "SDGB")] variant: AuthLiteVariant, }, /// Test delay to SDGB server Ping, /// Get basic info Preview { #[arg(short, long)] user_id: u32, }, /// Get B35 + B15 play records Rating { #[arg(short, long)] user_id: u32, /// JSON format. /// /// - `origin`: official json response /// - `dx_rating_net`: DxRatingNet Format #[arg(short, long, default_value_t = RatingFormat::default())] format: RatingFormat, }, /// Get all play records MusicDetail { #[arg(short, long)] user_id: u32, }, /// Retrieve full userdata /// /// WARNING: This requires to login & logout your account 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, }, } #[derive(Default, EnumString)] #[strum(serialize_all = "snake_case")] pub enum RatingFormat { #[default] /// Official API response Origin, /// dxrating.net format DxRatingNet, /// dxrating.net image gen payload DxRatingPayload, }