use clap::{Parser, Subcommand};
#[derive(Debug, Parser)]
#[command(author, version, about, long_about = None)]
pub enum Args {
Encrypt(ArgsEncryptDecrypt),
Decrypt(ArgsEncryptDecrypt),
#[command(subcommand)]
Keys(ArgsKeys),
#[command(subcommand)]
S3(ArgsS3),
}
#[derive(Debug, Parser)]
pub struct ArgsEncryptDecrypt {
#[arg(short, long, verbatim_doc_comment)]
pub from: Option<String>,
#[arg(short, long, verbatim_doc_comment)]
pub to: Option<String>,
#[arg(short = 'p', long)]
pub with_password: bool,
#[arg(short = 'k', long, verbatim_doc_comment)]
pub with_key_id: Option<String>,
#[arg(short, long)]
pub show_progress: bool,
#[arg(long)]
pub insecure: bool,
}
impl ArgsEncryptDecrypt {
pub fn from_to_fmt() -> String {
r#"Format:
File -> file:/path/to/your/file
S3 -> s3:bucket_name/object_name
Shell Input -> leave empty
"#
.to_string()
}
}
#[derive(Debug, Clone, Subcommand)]
pub enum ArgsKeys {
#[command(subcommand)]
Convert(ArgsKeysConvert),
List(ArgsKeysList),
NewRandom(ArgsKeysNew),
SetActive,
Import(ArgsKeysImport),
Export(ArgsKeysExport),
Delete,
}
#[derive(Debug, Clone, Subcommand)]
pub enum ArgsKeysConvert {
LegacyString,
}
#[derive(Debug, Clone, Parser)]
pub struct ArgsKeysList {
#[arg(short, long)]
pub file: Option<String>,
#[arg(short, long)]
pub show_values: bool,
}
#[derive(Debug, Clone, Parser)]
pub struct ArgsKeysNew {
#[arg(long)]
pub with_id: Option<String>,
}
#[derive(Debug, Clone, Parser)]
pub struct ArgsKeysImport {
#[arg(short, long)]
pub file: Option<String>,
}
#[derive(Debug, Clone, Parser)]
pub struct ArgsKeysExport {
#[arg(short, long)]
pub file: Option<String>,
#[arg(short, long)]
pub ids: Option<String>,
}
#[derive(Debug, Clone, Parser)]
pub enum ArgsS3 {
Show,
Update,
List(ArgsS3List),
}
#[derive(Debug, Clone, Parser)]
pub struct ArgsS3List {
#[arg(short, long)]
pub bucket: String,
#[arg(long)]
pub insecure: bool,
}