grepg 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3106a1e8e04894f0cb4b980682e95a64f7ad4894
4
- data.tar.gz: 999e07dbb13b6a0ced4ad7e96b0e8e1cbe7983bb
3
+ metadata.gz: d4461f02d7f064ba3c1b94e4c9d9e52585bfcc2a
4
+ data.tar.gz: facace3baba5687fecd162bede531d71bb87fbba
5
5
  SHA512:
6
- metadata.gz: c935a00315b2342f1b0fb849215d65f9755defd29ea54e018897a5385caa3a0e5c1fbe7c4b8d992a7e2fe7d1bc3227a77161299255180dfbebbc00e0f37438af
7
- data.tar.gz: 7d7db6a173f995fe8462b05efa2fc54f19889c7f14ac59bda243d228d9e1d6ed180ec8dde6631fcaf35515507cb9cfd1dd8fd8bb90dc016660a54e8175b3d34b
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 [-s search_term]
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 colorize output (default: true)
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 evidanary -t git
50
- User: evidanary, Topic: git
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 => true,
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 [-s search_term]
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}", "Topic: #{topic}"]
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
@@ -1,3 +1,3 @@
1
1
  module GrepPage
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
@@ -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.6
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-06 00:00:00.000000000 Z
11
+ date: 2016-06-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: trollop