Skip to content
This repository has been archived by the owner on Jun 13, 2022. It is now read-only.

Commit

Permalink
add static wait interval fixes #2
Browse files Browse the repository at this point in the history
  • Loading branch information
ciphax committed Nov 14, 2018
1 parent 97e019d commit 0056895
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,14 @@ fn run() -> Result<(), String> {
)
.arg(Arg::with_name("nodnscheck")
.long("no-dns-check")
.help("Don't wait for the dns record to be publicly visible")
.help("don't wait for the dns record to be publicly visible")
)
.arg(Arg::with_name("waitinterval")
.long("wait-interval")
.value_name("SECONDS")
.help("the amount of seconds to wait after creating a record")
.takes_value(true)
.default_value("5")
)
)
.subcommand(SubCommand::with_name("delete")
Expand All @@ -94,6 +101,7 @@ fn run() -> Result<(), String> {
let domain = lookup_real_domain(matches.value_of("domain").unwrap());
let value = matches.value_of("value").unwrap();
let (user, pass) = read_credentials(matches.value_of("credentialfile").unwrap())?;
let wait_interval = matches.value_of("waitinterval").unwrap().parse().map_err(|_| "Invalid wait interval!")?;

println!("Creating TXT record...");

Expand Down Expand Up @@ -127,6 +135,14 @@ fn run() -> Result<(), String> {

println!("=> done!");
}

if wait_interval > 0 {
println!("Waiting {} additional seconds...", &wait_interval);

sleep(Duration::from_secs(wait_interval));

println!("=> done!");
}
} else if let Some(matches) = matches.subcommand_matches("delete") {
let domain = lookup_real_domain(matches.value_of("domain").unwrap());
let (user, pass) = read_credentials(matches.value_of("credentialfile").unwrap())?;
Expand Down

0 comments on commit 0056895

Please sign in to comment.