Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added options for tld #16

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ dom --available zachwill
✓ zachwill.me
```

And, the `--tld` flag only shows top-level domains:
And, the `--tld <domain_names>` flag shows domains given to it as input:

```
dom --tld zachwill
dom zachwill --tld .com .net .org

✗ zachwill.com
✓ zachwill.net
Expand Down
9 changes: 5 additions & 4 deletions domainr/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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):
Expand Down