domainr-cli2 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +25 -19
- data/exe/domainr +1 -1
- data/lib/domainr/cli2/base.rb +25 -4
- data/lib/domainr/cli2/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c5d6ccab30bc5e335a2af8d9631f40f9f202b2c4
|
4
|
+
data.tar.gz: f6740d9c27d71577609e7dd0294d68c2bcdc8fae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ccf1e7d7af0fdabd6787eb96d512259776a5308abc5837ba0896a1847c5ce06e88a940f49ea1b967b174ac8f85c195bb92dc7f8d7e5c34d685039edf7b399d06
|
7
|
+
data.tar.gz: 03fb8a176764f6f88052a787d0af5f3d73e7895d9fb7b6c3a93b1bddcea5ccc2351c15861d2f5ed40faa8f6303ce9713048a39f4d2fe2aee71685bad9fc53093
|
data/README.md
CHANGED
@@ -6,7 +6,9 @@ Search for domains using [Domainr](https://domainr.com/) from the command line.
|
|
6
6
|
|
7
7
|
Install with:
|
8
8
|
|
9
|
-
|
9
|
+
```
|
10
|
+
$ gem install domainr-cli2
|
11
|
+
```
|
10
12
|
|
11
13
|
## Setup
|
12
14
|
|
@@ -14,29 +16,33 @@ Install with:
|
|
14
16
|
|
15
17
|
Once you have your key, set it once and forget it:
|
16
18
|
|
17
|
-
|
19
|
+
```
|
20
|
+
$ domainr api_key <your-api-key-here>
|
21
|
+
```
|
18
22
|
|
19
23
|
## Usage
|
20
24
|
|
21
25
|
Use the `search` command to look for domains:
|
22
26
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
27
|
+
```
|
28
|
+
$ domainr search awesomeness
|
29
|
+
+-------------+-----------------+------------------------+
|
30
|
+
| Status | Domain | Path |
|
31
|
+
+-------------+-----------------+------------------------+
|
32
|
+
| UNAVAILABLE | awesomeness.com | http://awesomeness.com |
|
33
|
+
| UNAVAILABLE | awesomeness.net | http://awesomeness.net |
|
34
|
+
| DELETING | awesomeness.org | http://awesomeness.org |
|
35
|
+
| UNAVAILABLE | awesomeness.us | http://awesomeness.us |
|
36
|
+
| UNAVAILABLE | awesomen.es | http://awesomen.es/s |
|
37
|
+
| UNKNOWN | awesome.ne | http://awesome.ne/ss |
|
38
|
+
| PREMIUM | aweso.men | http://aweso.men/ess |
|
39
|
+
| UNAVAILABLE | aweso.me | http://aweso.me/ness |
|
40
|
+
| UNAVAILABLE | awes.om | http://awes.om/eness |
|
41
|
+
| UNAVAILABLE | awe.so | http://awe.so/meness |
|
42
|
+
| UNAVAILABLE | aw.es | http://aw.es/omeness |
|
43
|
+
| UNAVAILABLE | aw | http://aw/esomeness |
|
44
|
+
+-------------+-----------------+------------------------+
|
45
|
+
```
|
40
46
|
|
41
47
|
## Contributing
|
42
48
|
|
data/exe/domainr
CHANGED
data/lib/domainr/cli2/base.rb
CHANGED
@@ -2,14 +2,29 @@ module Domainr
|
|
2
2
|
module CLI2
|
3
3
|
class Base < Thor
|
4
4
|
API_KEY_STORAGE_LOCATION = '~/.domainr-cli2'.freeze
|
5
|
+
DEFAULT_COMMAND = 'search'.freeze
|
6
|
+
STATUS_FETCH_PREFIX = 'Fetching status... '.freeze
|
5
7
|
|
6
8
|
class_option :verbose, type: :boolean, default: false
|
7
9
|
class_option :status, type: :boolean, default: true
|
8
10
|
|
11
|
+
def self.rewrite_arguments(arguments)
|
12
|
+
options_removed = arguments.reject { |a| a =~ /^\-/ }
|
13
|
+
arguments.unshift(DEFAULT_COMMAND) if options_removed.count == 1 && !Domainr::CLI2::Base.commands.keys.include?(options_removed.first)
|
14
|
+
arguments
|
15
|
+
end
|
16
|
+
|
17
|
+
desc 'version', 'print the version number'
|
18
|
+
def version
|
19
|
+
puts Domainr::CLI2::VERSION
|
20
|
+
end
|
21
|
+
|
9
22
|
desc "search TERM", "Execute a fuzzy search for domains like TERM"
|
10
23
|
def search(name)
|
11
24
|
results = client.search(name)
|
12
25
|
if results.any?
|
26
|
+
puts "Found #{results.count.to_s.green} possible domains."
|
27
|
+
print_and_flush STATUS_FETCH_PREFIX if options[:status]
|
13
28
|
puts results_table(results)
|
14
29
|
else
|
15
30
|
puts "Nothing available for that."
|
@@ -51,8 +66,8 @@ module Domainr
|
|
51
66
|
|
52
67
|
def results_table(results)
|
53
68
|
::Terminal::Table.new headings: %w(Status Domain Path) do |table|
|
54
|
-
results.each do |result|
|
55
|
-
status = options[:status] ? get_status(result.domain) : nil
|
69
|
+
results.each.with_index do |result, index|
|
70
|
+
status = options[:status] ? get_status(result.domain, index+1, results.count) : nil
|
56
71
|
table.add_row [
|
57
72
|
colorize_status(status),
|
58
73
|
result.domain,
|
@@ -99,15 +114,21 @@ module Domainr
|
|
99
114
|
:red
|
100
115
|
when :inactive
|
101
116
|
:green
|
102
|
-
when :priced
|
117
|
+
when :priced, :marketed
|
103
118
|
:yellow
|
104
119
|
else
|
105
120
|
:to_s
|
106
121
|
end
|
107
122
|
end
|
108
123
|
|
109
|
-
def
|
124
|
+
def print_and_flush(text)
|
125
|
+
print "#{text}\r"
|
126
|
+
$stdout.flush
|
127
|
+
end
|
128
|
+
|
129
|
+
def get_status(domain, current, total)
|
110
130
|
debug "Fetching status for: #{domain.inspect}"
|
131
|
+
print_and_flush "#{STATUS_FETCH_PREFIX} #{current}/#{total}" if options[:status]
|
111
132
|
client.status(domain).first
|
112
133
|
end
|
113
134
|
|
data/lib/domainr/cli2/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: domainr-cli2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Bielinski
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-06-
|
11
|
+
date: 2016-06-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|