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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4e74f5d463a7c60fb6a697aec201d32b5ff40a35
4
- data.tar.gz: 6dec980e21ff8cbcc8d1ee9e61e22d115d2bf09c
3
+ metadata.gz: 19e38304d5db7cc98da0f3660a476fe82f0cf272
4
+ data.tar.gz: cf6cc1aec755961576535947fa183bf1333c8c77
5
5
  SHA512:
6
- metadata.gz: cac39e03a3fa32efede575bc73d218839a4c64b05a0d5704d00df81c912621318083c8a1a8aa259acbe06721008488dfa341840dbc1973fac2a5479cc18fcbbe
7
- data.tar.gz: e0677f7a5d5f29c7781fd7e73378ff796a57649666f9f3fb1295191dc1037141477b20e3d62925260f0dc7c10f3c3794db11c7a4914184626ccc89f7b5e018a2
6
+ metadata.gz: 4508647eb8ed11ae58f10c380f8f4dd4297c7b00c3f9cb058d842924820cb2d64a21228834fbc00a4ac64450893bdc5d495fe5774b9905553c802739fb44bc27
7
+ data.tar.gz: 227b25c6d687dfc75ed4285e639aa3755ed1f1ff2b25526668fef5c59b13ff6274ea5c92ad95497b08160061e5d1e92cb0f6616b6e335aa30f53cab7edb9145b
data/.gitignore CHANGED
@@ -1 +1,9 @@
1
- pkg
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- pecorb (1.0.1)
4
+ pecorb (1.0.2)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -1,8 +1,22 @@
1
1
  # Pecorb
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/pecorb`. To experiment with that code, run `bin/console` for an interactive prompt.
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
- TODO: Delete this and the text above, and describe your gem
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
- TODO: Write usage instructions here
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 `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
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`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
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 https://github.com/[USERNAME]/pecorb.
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 [MIT License](http://opensource.org/licenses/MIT).
71
+ The gem is available as open source under the terms of the
72
+ [MIT License](http://opensource.org/licenses/MIT).
41
73
 
@@ -1,3 +1,3 @@
1
1
  module Pecorb
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.2"
3
3
  end
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.1
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-29 00:00:00.000000000 Z
11
+ date: 2016-12-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler