grepg 0.0.6 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +17 -4
- data/lib/grepg/parser.rb +11 -3
- data/lib/grepg/version.rb +1 -1
- data/spec/grepg/parser_spec.rb +6 -0
- 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: d4461f02d7f064ba3c1b94e4c9d9e52585bfcc2a
|
4
|
+
data.tar.gz: facace3baba5687fecd162bede531d71bb87fbba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3a5f2b0cac9fce61381180a5c17a9674819a3580377a601e2190eb9dc978c656827a6629bce6ce634a2e6e7dcb1623a2ff8f7f05688ce29bc988f14c55a5a940
|
7
|
+
data.tar.gz: 05a78e200bede2dfafce4a7680c73c099e245172592c253d073bc593247a8dba21dd00bf766e29c438c4f5c3c6dafb4a2e3df1bd7cf5a6147f5c894809a3bc24
|
data/README.md
CHANGED
@@ -23,17 +23,18 @@ Enter user and topic name followed by an optional search string.
|
|
23
23
|
```
|
24
24
|
$ grepg --help
|
25
25
|
Usage:
|
26
|
-
grepg -u user_name -t topic_name
|
26
|
+
grepg -u user_name [-t topic_name -s search_term]
|
27
27
|
|
28
28
|
Options:
|
29
29
|
-u, --user=<s> username
|
30
30
|
-t, --topic=<s> topic
|
31
31
|
-s, --search=<s> text to search
|
32
|
-
-c, --colorize
|
32
|
+
-c, --colorize colorize output
|
33
33
|
-v, --version Print version and exit
|
34
34
|
-h, --help Show this message
|
35
35
|
|
36
36
|
Examples:
|
37
|
+
grepg -u evidanary
|
37
38
|
grepg -u evidanary -t css
|
38
39
|
greppg -u evidanary -t css -s color
|
39
40
|
|
@@ -43,11 +44,23 @@ Defaults:
|
|
43
44
|
```
|
44
45
|
|
45
46
|
|
47
|
+
To list all topics for a user
|
48
|
+
|
49
|
+
```
|
50
|
+
$ grepg -u kdavis
|
51
|
+
User: kdavis
|
52
|
+
Available Topics =>
|
53
|
+
CSS
|
54
|
+
ES6
|
55
|
+
...
|
56
|
+
|
57
|
+
```
|
58
|
+
|
46
59
|
For example, to get all cheats for the `git` topic for user `kdavis`
|
47
60
|
|
48
61
|
```
|
49
|
-
$ grepg -u
|
50
|
-
User:
|
62
|
+
$ grepg -u kdavis -t git
|
63
|
+
User: kdavis, Topic: git
|
51
64
|
push tags to remote / Github
|
52
65
|
git push --tags
|
53
66
|
|
data/lib/grepg/parser.rb
CHANGED
@@ -16,7 +16,7 @@ module GrepPage
|
|
16
16
|
opt :topic,
|
17
17
|
"topic",
|
18
18
|
:type => :string,
|
19
|
-
:required =>
|
19
|
+
:required => false,
|
20
20
|
:short => "-t"
|
21
21
|
opt :search,
|
22
22
|
"text to search",
|
@@ -32,7 +32,7 @@ module GrepPage
|
|
32
32
|
banner <<-EOS
|
33
33
|
|
34
34
|
Usage:
|
35
|
-
grepg -u user_name -t topic_name
|
35
|
+
grepg -u user_name [-t topic_name -s search_term]
|
36
36
|
|
37
37
|
Examples:
|
38
38
|
grepg -u evidanary -t css
|
@@ -92,7 +92,8 @@ Defaults:
|
|
92
92
|
end
|
93
93
|
|
94
94
|
def process_args(user, topic, search_term, colorize)
|
95
|
-
headers = ["User: #{user}"
|
95
|
+
headers = ["User: #{user}"]
|
96
|
+
headers << "Topic: #{topic}" if topic
|
96
97
|
headers << "Search-Term: #{search_term}" if search_term
|
97
98
|
puts headers.join(", ")
|
98
99
|
|
@@ -102,6 +103,13 @@ Defaults:
|
|
102
103
|
raise GrepPage::NotFoundError, "Unable to find user"
|
103
104
|
end
|
104
105
|
|
106
|
+
unless topic
|
107
|
+
# No topic specified so show all topics
|
108
|
+
puts "Available Topics => "
|
109
|
+
puts topics.map{|t| t[:name]}
|
110
|
+
return
|
111
|
+
end
|
112
|
+
|
105
113
|
topic = filter_topics(topics, topic)
|
106
114
|
if topic.nil? || topic.empty?
|
107
115
|
puts "Can't find that topic. Choose one of the following"
|
data/lib/grepg/version.rb
CHANGED
data/spec/grepg/parser_spec.rb
CHANGED
@@ -45,6 +45,12 @@ describe GrepPage::Parser do
|
|
45
45
|
expect(output).to match(/Missing --user parameter.*--user.*"/)
|
46
46
|
end.to raise_error(SystemExit)
|
47
47
|
end
|
48
|
+
|
49
|
+
it "shows all topics when no topic filter is specified" do
|
50
|
+
parser = GrepPage::Parser.new('-u kdavis'.split(' '))
|
51
|
+
output = capture_stdout { parser.run! }
|
52
|
+
expect(output).to match(/UNIX/)
|
53
|
+
end
|
48
54
|
end
|
49
55
|
end
|
50
56
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: grepg
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yash Ranadive
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-06-
|
11
|
+
date: 2016-06-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: trollop
|