From 40123f9ba8a51800c5f91892d213f90c236cf517 Mon Sep 17 00:00:00 2001 From: Andrew Ayer Date: Mon, 22 Feb 2016 14:18:56 -0800 Subject: [PATCH] Allow . to be specified on stdin as well --- cmd/ctwatch/main.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/cmd/ctwatch/main.go b/cmd/ctwatch/main.go index 97711d8..ea52b0e 100644 --- a/cmd/ctwatch/main.go +++ b/cmd/ctwatch/main.go @@ -18,8 +18,14 @@ var watchDomainSuffixes []string func setWatchDomains (domains []string) { for _, domain := range domains { - watchDomains = append(watchDomains, strings.ToLower(domain)) - watchDomainSuffixes = append(watchDomainSuffixes, "." + strings.ToLower(domain)) + if domain == "." { // "." as in root zone (matches everything) + watchDomains = []string{} + watchDomainSuffixes = []string{""} + break + } else { + watchDomains = append(watchDomains, strings.ToLower(domain)) + watchDomainSuffixes = append(watchDomainSuffixes, "." + strings.ToLower(domain)) + } } } @@ -97,8 +103,6 @@ func main() { os.Exit(3) } setWatchDomains(domains) - } else if flag.NArg() == 1 && flag.Arg(0) == "." { // "." as in root zone - watchDomainSuffixes = []string{""} } else { setWatchDomains(flag.Args()) }