pecorb 1.0.1 → 1.0.2
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/.gitignore +9 -1
- data/Gemfile.lock +1 -1
- data/README.md +39 -7
- data/lib/pecorb/version.rb +1 -1
- data/lib/pecorb.rb +3 -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: 19e38304d5db7cc98da0f3660a476fe82f0cf272
|
4
|
+
data.tar.gz: cf6cc1aec755961576535947fa183bf1333c8c77
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4508647eb8ed11ae58f10c380f8f4dd4297c7b00c3f9cb058d842924820cb2d64a21228834fbc00a4ac64450893bdc5d495fe5774b9905553c802739fb44bc27
|
7
|
+
data.tar.gz: 227b25c6d687dfc75ed4285e639aa3755ed1f1ff2b25526668fef5c59b13ff6274ea5c92ad95497b08160061e5d1e92cb0f6616b6e335aa30f53cab7edb9145b
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,8 +1,22 @@
|
|
1
1
|
# Pecorb
|
2
2
|
|
3
|
-
|
3
|
+
This is a simple CLI tool to generate a user-selectable menu.
|
4
|
+
It is based on `inquirer.js` and `peco` (which itself is based on `percol`).
|
4
5
|
|
5
|
-
|
6
|
+
The above mentioned tools are all more feature rich than this one (and I'm sure
|
7
|
+
the code is better too), but I wanted a few different features:
|
8
|
+
|
9
|
+
- A list that can be navigated using the arrow keys (like `enquirer`)
|
10
|
+
- Fuzzy filterable (like `ctrl-p` in vim, etc.)
|
11
|
+
- Not take over the entire screen (like curses interfaces normally do)
|
12
|
+
- (Ideally) dependency free
|
13
|
+
|
14
|
+
## Status
|
15
|
+
|
16
|
+
Currently this works well on the command line but may still have some bugs.
|
17
|
+
Using it as part of a ruby program still needs to be tested.
|
18
|
+
|
19
|
+
This was written during a hackathon and has no tests :'(
|
6
20
|
|
7
21
|
## Installation
|
8
22
|
|
@@ -22,20 +36,38 @@ Or install it yourself as:
|
|
22
36
|
|
23
37
|
## Usage
|
24
38
|
|
25
|
-
|
39
|
+
For use on the command-line:
|
40
|
+
|
41
|
+
```
|
42
|
+
ls | pecorb | cat
|
43
|
+
pecorb myFile.txt
|
44
|
+
```
|
45
|
+
|
46
|
+
For use in a ruby program:
|
47
|
+
|
48
|
+
```ruby
|
49
|
+
Pecorb.prompt %w[Apples Bananas Cake Donuts]
|
50
|
+
Pecorb.prompt %w[Apples Bananas Cake Donuts], "Favourite food: "
|
51
|
+
```
|
26
52
|
|
27
53
|
## Development
|
28
54
|
|
29
|
-
After checking out the repo, run `
|
55
|
+
After checking out the repo, run `bundle install` to install dependencies.
|
30
56
|
|
31
|
-
To install this gem onto your local machine, run `bundle exec rake install`.
|
57
|
+
To install this gem onto your local machine, run `bundle exec rake install`.
|
58
|
+
To release a new version, update the version number in `version.rb`, and then
|
59
|
+
run `bundle install` and `bundle exec rake release`, which will create a git
|
60
|
+
tag for the version, push git commits and tags, and push the `.gem` file to
|
61
|
+
[rubygems.org](https://rubygems.org).
|
32
62
|
|
33
63
|
## Contributing
|
34
64
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at
|
65
|
+
Bug reports and pull requests are welcome on GitHub at
|
66
|
+
https://github.com/stevenocchipinti/pecorb.
|
36
67
|
|
37
68
|
|
38
69
|
## License
|
39
70
|
|
40
|
-
The gem is available as open source under the terms of the
|
71
|
+
The gem is available as open source under the terms of the
|
72
|
+
[MIT License](http://opensource.org/licenses/MIT).
|
41
73
|
|
data/lib/pecorb/version.rb
CHANGED
data/lib/pecorb.rb
CHANGED
@@ -7,6 +7,8 @@ module Pecorb
|
|
7
7
|
KILL_LINE_CHAR = "\x1B[K"
|
8
8
|
CURSOR_UP_CHAR = "\x1B[A"
|
9
9
|
CSI = "\e["
|
10
|
+
SELECTED_COLOR = "#{CSI}\e[36m"
|
11
|
+
RESET_COLOR = "#{CSI}\e[0m"
|
10
12
|
|
11
13
|
@input = ""
|
12
14
|
@cursor = 0
|
@@ -117,7 +119,7 @@ module Pecorb
|
|
117
119
|
|
118
120
|
def print_items(items)
|
119
121
|
items.each_with_index do |item, i|
|
120
|
-
$stderr.puts "#{@selected == i ? "‣" : " "} #{item}"
|
122
|
+
$stderr.puts "#{@selected == i ? "#{SELECTED_COLOR}‣" : " "} #{item}#{RESET_COLOR}"
|
121
123
|
end
|
122
124
|
end
|
123
125
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pecorb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steven Occhipinti
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-12-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|