grepg 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +15 -12
- data/img/screenshot.png +0 -0
- data/lib/grepg/parser.rb +6 -1
- data/lib/grepg/version.rb +1 -1
- data/spec/grepg/parser_spec.rb +11 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cee82c12d92813e766763700c3fea73eb1d20f3a
|
4
|
+
data.tar.gz: bc0ed894ffecec938bebf35369bdfc97438e2195
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 82fe6a2c37ebcf1e40ec3d3543d0e36aa7534e070900042eb19aef525af5ddeedeb90f61d45f0ef89ff25e4a87d1a5ef32d8e3d4f884d9bcbf9391a8b43cf3f4
|
7
|
+
data.tar.gz: 227627ba0b54bb55b037df46a2e9e86328b70e2d01a3aa45cbff76f3809cbf7fa09c9761c34472522c8369c02690eb0009c3c161416d6609fb732ab7d856b151
|
data/README.md
CHANGED
@@ -3,15 +3,23 @@ grepg
|
|
3
3
|
|
4
4
|
`grepg` (pronounced Grep G) is a ruby client for [GrepPage](https://www.greppage.com). It allows you to access your cheat sheets without leaving the terminal.
|
5
5
|
|
6
|
+
![grepg screenshot](https://github.com/evidanary/grepg/raw/master/img/screenshot.png)
|
7
|
+
|
6
8
|
#Installation
|
7
|
-
To install `grepg` run
|
9
|
+
To install `grepg` run
|
8
10
|
|
9
11
|
```
|
10
12
|
gem install grepg
|
11
13
|
```
|
12
14
|
|
15
|
+
#Requirements
|
16
|
+
- ruby (tested on 2.1.2)
|
17
|
+
|
18
|
+
|
13
19
|
#Usage
|
14
20
|
|
21
|
+
Enter user and topic name followed by an optional search string.
|
22
|
+
|
15
23
|
```
|
16
24
|
$ grepg --help
|
17
25
|
Usage:
|
@@ -21,7 +29,7 @@ Options:
|
|
21
29
|
-u, --user=<s> username
|
22
30
|
-t, --topic=<s> topic
|
23
31
|
-s, --search=<s> text to search
|
24
|
-
-c, --colorize
|
32
|
+
-c, --colorize colorize output (default: true)
|
25
33
|
-v, --version Print version and exit
|
26
34
|
-h, --help Show this message
|
27
35
|
|
@@ -56,15 +64,10 @@ $ grepg -u kdavis -t git -s stash
|
|
56
64
|
User: kdavis, Topic: git, Search-Term: stash
|
57
65
|
TO apply your changes
|
58
66
|
git stash --apply
|
59
|
-
|
60
|
-
To list the stash
|
61
|
-
git stash list
|
62
|
-
|
63
|
-
Git stash
|
64
|
-
git stash
|
67
|
+
...
|
65
68
|
```
|
66
69
|
|
67
|
-
#
|
70
|
+
#Configuration
|
68
71
|
Setup defaults in `~/.grepg.yml`
|
69
72
|
|
70
73
|
```
|
@@ -72,7 +75,7 @@ user: evidanary
|
|
72
75
|
colorize: true
|
73
76
|
```
|
74
77
|
|
75
|
-
Now, you can
|
78
|
+
Now, you can do
|
76
79
|
|
77
80
|
```
|
78
81
|
$ grepg -t bootstrap
|
@@ -80,8 +83,8 @@ User: evidanary, Topic: bootstrap
|
|
80
83
|
...
|
81
84
|
```
|
82
85
|
|
83
|
-
|
86
|
+
#Development
|
84
87
|
To execute tests run ```bundle exec rake spec```. To install the gem locally, first build it using ```bundle exec rake build```. Then install the gem ```gem install pkg/grepg-0.0.1.gem```
|
85
88
|
|
86
|
-
|
89
|
+
#License
|
87
90
|
grepg is under the [MIT License](http://www.opensource.org/licenses/MIT).
|
data/img/screenshot.png
ADDED
Binary file
|
data/lib/grepg/parser.rb
CHANGED
@@ -47,7 +47,12 @@ Defaults:
|
|
47
47
|
end
|
48
48
|
|
49
49
|
@opts = Trollop::with_standard_exception_handling parser do
|
50
|
-
parser.parse args
|
50
|
+
opts = parser.parse args
|
51
|
+
# User is a required field, manually handling validation because
|
52
|
+
# we fallback on defaults from the file
|
53
|
+
raise Trollop::CommandlineError,
|
54
|
+
"Missing --user parameter. e.g. --user evidanary" unless opts[:user]
|
55
|
+
opts
|
51
56
|
end
|
52
57
|
|
53
58
|
@user = @opts[:user]
|
data/lib/grepg/version.rb
CHANGED
data/spec/grepg/parser_spec.rb
CHANGED
@@ -34,6 +34,17 @@ describe GrepPage::Parser do
|
|
34
34
|
parser = GrepPage::Parser.new('-t css'.split(' '))
|
35
35
|
expect(parser.instance_variable_get(:@opts)[:user]).to eq('kdavis')
|
36
36
|
end
|
37
|
+
|
38
|
+
# Test if we get an error when no user is specified. We should tell the user
|
39
|
+
# a sample username they can use if they want to try the client out without
|
40
|
+
# creating an account
|
41
|
+
it "errors when no user is specified" do
|
42
|
+
expect(File).to receive(:exist?).and_return(false)
|
43
|
+
expect do
|
44
|
+
output = GrepPage::Parser.new('-t css'.split(' '))
|
45
|
+
expect(output).to match(/Missing --user parameter.*--user.*"/)
|
46
|
+
end.to raise_error(SystemExit)
|
47
|
+
end
|
37
48
|
end
|
38
49
|
end
|
39
50
|
|
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.5
|
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-05-
|
11
|
+
date: 2016-05-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: trollop
|
@@ -109,6 +109,7 @@ files:
|
|
109
109
|
- Rakefile
|
110
110
|
- bin/grepg
|
111
111
|
- grepg.gemspec
|
112
|
+
- img/screenshot.png
|
112
113
|
- lib/grepg.rb
|
113
114
|
- lib/grepg/api.rb
|
114
115
|
- lib/grepg/formatter.rb
|