Reorder the config members and functions based on the short parameter

This commit is contained in:
Rodolphe Bréard 2023-03-26 22:12:50 +02:00
parent 7ac2f2645e
commit 1576a990fe

View file

@ -30,10 +30,10 @@ pub struct Config {
revocation: u64,
#[arg(short = 'u', long)]
dns_update_cmd: String,
#[arg(short = 'x', long, default_value_t = 1296000)]
expiration: u64,
#[arg(short, long, action = clap::ArgAction::Count)]
verbose: u8,
#[arg(short = 'x', long, default_value_t = 1296000)]
expiration: u64,
}
impl Config {
@ -53,26 +53,10 @@ impl Config {
self.canonicalization
}
pub fn cryptoperiod(&self) -> NonZeroU64 {
self.cryptoperiod
}
pub fn dns_update_cmd(&self) -> &str {
&self.dns_update_cmd
}
pub fn domains(&self) -> &[String] {
&self.domain
}
pub fn expiration(&self) -> Option<u64> {
if self.expiration != 0 {
Some(self.expiration)
} else {
None
}
}
pub fn headers(&self) -> &[String] {
&self.header
}
@ -81,13 +65,29 @@ impl Config {
&self.header_optional
}
pub fn cryptoperiod(&self) -> NonZeroU64 {
self.cryptoperiod
}
pub fn revocation(&self) -> u64 {
self.revocation
}
pub fn dns_update_cmd(&self) -> &str {
&self.dns_update_cmd
}
pub fn verbosity(&self) -> log::LevelFilter {
crate::logs::log_level(self.verbose)
}
pub fn expiration(&self) -> Option<u64> {
if self.expiration != 0 {
Some(self.expiration)
} else {
None
}
}
}
fn process_domains(lst: &[String], domain_file: &Option<PathBuf>) -> Result<Vec<String>, String> {