From 0455a9597ceb3a6d5e46e88405eb1027471269f4 Mon Sep 17 00:00:00 2001 From: Anshuman Date: Tue, 8 Dec 2015 19:26:15 +0530 Subject: [PATCH 1/2] --tld flag now takes arguments for domains to be searched in input.Needs testing. --- README.md | 4 ++-- domainr/core.py | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index df0741e..de44cf1 100644 --- a/README.md +++ b/README.md @@ -52,10 +52,10 @@ dom --available zachwill ✓ zachwill.me ``` -And, the `--tld` flag only shows top-level domains: +And, the `--tld ` flag shows domains given to it as input: ``` -dom --tld zachwill +dom --tld zachwill .com .net .org ✗ zachwill.com ✓ zachwill.net diff --git a/domainr/core.py b/domainr/core.py index 1a78c82..a9328f1 100644 --- a/domainr/core.py +++ b/domainr/core.py @@ -23,8 +23,8 @@ def environment(self): help="Use ASCII characters for domain availability.") parser.add_argument('--available', action='store_true', help="Only show domain names that are currently available.") - parser.add_argument('--tld', action='store_true', - help="Only check for top-level domains.") + parser.add_argument('--tld', type=str, nargs='+', + help="Only check for top-level domains (provided with spaces)") args = parser.parse_args() return args @@ -74,8 +74,9 @@ def parse(self, content, env): def _tld_check(self, name): """Make sure we're dealing with a top-level domain.""" - if name.endswith(".com") or name.endswith(".net") or name.endswith(".org"): - return True + for domain_name in env.tld: + if name.endswith(domain_name): + return True return False def main(self): From 73b7194252ee3387ea6f56735477903056d11484 Mon Sep 17 00:00:00 2001 From: Anshuman Suri Date: Tue, 8 Dec 2015 19:28:22 +0530 Subject: [PATCH 2/2] Update README.md Updated README to match added feature --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index de44cf1..9c635c3 100644 --- a/README.md +++ b/README.md @@ -52,10 +52,10 @@ dom --available zachwill ✓ zachwill.me ``` -And, the `--tld ` flag shows domains given to it as input: +And, the `--tld ` flag shows domains given to it as input: ``` -dom --tld zachwill .com .net .org +dom zachwill --tld .com .net .org ✗ zachwill.com ✓ zachwill.net