diff --git a/README.md b/README.md index df0741e..9c635c3 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 zachwill --tld .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):