use std::fmt;
use std::str::FromStr;
#[derive(Debug, clap::ValueEnum, Clone)]
enum DumpFormat {
OpenLDAPMemDump,
}
impl FromStr for DumpFormat {
type Err = &'static str;
fn from_str(s: &str) -> Result<Self, Self::Err> {
match s {
"openldap_mem_dump" => Ok(DumpFormat::OpenLDAPMemDump),
_ => Err("Unknown DumpFormat. Valid choices are openldap_mem_dump"),
}
}
}
impl fmt::Display for DumpFormat {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "DumpFormats: openldap_mem_dump_json")
}
}
#[derive(Debug, clap::Args)]
struct BerDumpOptions {
#[clap(short, long)]
format: DumpFormat,
#[clap(short, long)]
path: PathBuf,
}
#[derive(Debug, clap::Subcommand)]
enum LdapDebugAction {
BerDump(BerDumpOptions),
}
#[derive(Debug, clap::Parser)]
#[clap(about = "Ldap Debugging Utility")]
struct LdapDebugOpt {
#[clap(short, long)]
verbose: bool,
#[clap(subcommand)]
action: LdapDebugAction,
}