Small improvements to CLI

This commit is contained in:
Alex Page 2023-06-24 16:30:41 -04:00
parent 2bed0f88d1
commit 9029d35a6b

View file

@ -14,58 +14,62 @@ pub struct Cli {
#[derive(Subcommand, Clone, Debug)] #[derive(Subcommand, Clone, Debug)]
pub enum Commands { pub enum Commands {
/// Show which products/binks can be loaded /// Show which products/binks can be loaded
#[command(visible_alias = "l")]
List(ListArgs), List(ListArgs),
/// Generate new product keys /// Generate new product keys
#[command(visible_alias = "g")]
Generate(GenerateArgs), Generate(GenerateArgs),
/// Validate a product key /// Validate a product key
#[command(visible_alias = "v")]
Validate(ValidateArgs), Validate(ValidateArgs),
/// Generate a phone activation Confirmation ID from an Installation ID /// Generate a phone activation Confirmation ID from an Installation ID
#[command(name = "confid")] #[command(name = "confid", visible_alias = "c")]
ConfirmationId(ConfirmationIdArgs), ConfirmationId(ConfirmationIdArgs),
} }
#[derive(Args, Clone, Debug)] #[derive(Args, Clone, Debug)]
pub struct ListArgs { pub struct ListArgs {
/// Optional path to load a keys.json file /// Optional path to load a keys.json file
#[arg(short = 'f', long = "file")] #[arg(short, long = "keys")]
pub keys_path: Option<String>, pub keys_path: Option<String>,
} }
#[derive(Args, Clone, Debug)] #[derive(Args, Clone, Debug)]
pub struct GenerateArgs { pub struct GenerateArgs {
/// Which BINK identifier to use /// Which BINK identifier to use
#[arg(short, long, default_value = "2E")] #[arg(short, long = "bink", default_value = "2E")]
pub binkid: String, pub bink_id: String,
/// Channel Identifier to use /// Channel Identifier to use
#[arg(short = 'c', long = "channel", default_value = "640")] #[arg(short, long = "channel", default_value = "640")]
pub channel_id: u32, pub channel_id: u32,
/// Number of keys to generate /// Number of keys to generate
#[arg(short = 'n', long = "number", default_value = "1")] #[arg(short = 'n', long = "number", default_value = "1")]
pub num_keys: u64, pub count: u64,
/// Optional path to load a keys.json file /// Optional path to load a keys.json file
#[arg(short = 'f', long = "file")] #[arg(short, long = "keys")]
pub keys_path: Option<String>, pub keys_path: Option<String>,
} }
#[derive(Args, Clone, Debug)] #[derive(Args, Clone, Debug)]
pub struct ValidateArgs { pub struct ValidateArgs {
/// Which BINK identifier to use /// Which BINK identifier to use
#[arg(short, long, default_value = "2E")] #[arg(short, long = "bink", default_value = "2E")]
pub binkid: String, pub bink_id: String,
/// Optional path to load a keys.json file /// Optional path to load a keys.json file
#[arg(short = 'f', long = "file")] #[arg(short, long = "keys")]
pub keys_path: Option<String>, pub keys_path: Option<String>,
/// The Product key to validate /// The Product key to validate, with or without hyphens
pub key_to_check: String, pub key_to_check: String,
} }
#[derive(Args, Clone, Debug)] #[derive(Args, Clone, Debug)]
pub struct ConfirmationIdArgs { pub struct ConfirmationIdArgs {
/// The Installation ID used to generate the Confirmation ID /// The Installation ID used to generate the Confirmation ID
#[arg(name = "INSTALLATION_ID")]
pub instid: String, pub instid: String,
} }