fuzz 0.1.2 → 0.2.0

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
  SHA256:
3
- metadata.gz: f9d42afd0f155728e3950089a89cf53ea30567cd151f40726a3e554e0a734daa
4
- data.tar.gz: 0f384622fe5d6c66e6ac7c09b2221a972a4c7155ed51513c2fde9fab9266cf50
3
+ metadata.gz: f98b1a90c7d969b3844cfcc64615c90d5b1d378e5cd76e79811d2272b727f904
4
+ data.tar.gz: '08db792fa58a84d9b17d8d688355a34c8e0dbc2509ab99b56df9e3be52bceb54'
5
5
  SHA512:
6
- metadata.gz: 2e25ce9074901620fdeeb50a4aaaa90ec0b39d7c7ba0af27797d186e6fe9f63f8a52772ff81a59d13b9c87bfd8cc16912308ae1888d27a8936d354e1ae610039
7
- data.tar.gz: 23c5622897c83d6dbb517adaa6dae68004b29761403b9339a7633cffdee55ff7addb2af0ee31099f7e7c322f7a807fa9e563a05be3c0f3536311b1c3e9f77bd9
6
+ metadata.gz: f7cc07b5edaa679982db909227ea627721c200e376cd58ca96df9f964f4f6d343a278eb2785d141121233f4d5bebe643dd89273d6f476b9b8a1fdb3fa8600690
7
+ data.tar.gz: b3bc45fe924fe680a39a3629c22578788fc66447fd507473af0075451585e01da54406908a06b75c2220d7a5b69ba6d275a8902bfa0e1ae9bb81aad5d95c6825
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- ## Fuzz: interactively select Ruby objects with `rofi`, `dmenu`, or `pick`
1
+ ## Fuzz: A Ruby wrapper around interactive filtering tools
2
2
 
3
3
  [![Build Status](https://travis-ci.org/hrs/fuzz.svg?branch=master)](https://travis-ci.org/hrs/fuzz)
4
4
  [![Maintainability](https://api.codeclimate.com/v1/badges/326b820a889742177ec2/maintainability)](https://codeclimate.com/github/hrs/fuzz/maintainability)
@@ -11,7 +11,7 @@ or just an arbitrary object.
11
11
 
12
12
  [rofi][] and [dmenu][] are really cool tools for that! They provide a visual way
13
13
  for a user to use fuzzy searching to choose among a selection of strings.
14
- [pick][] provides a similar service on the command line with ncurses.
14
+ [pick][], [peco][], and [selecta][] provide similar services on the command line.
15
15
 
16
16
  Unfortunately, though, these tools do *just* choose between strings. But my
17
17
  scripts would often be a lot simpler if the user were able to select arbitrary
@@ -23,9 +23,16 @@ scripts.
23
23
  [rofi]: https://github.com/DaveDavenport/rofi
24
24
  [dmenu]: https://tools.suckless.org/dmenu
25
25
  [pick]: https://github.com/calleerlandsson/pick
26
+ [peco]: https://github.com/peco/peco
27
+ [selecta]: https://github.com/garybernhardt/selecta
26
28
 
27
29
  ### For example
28
30
 
31
+ There are more [interesting examples in the wiki][], but here's a simple one to
32
+ get started.
33
+
34
+ [interesting examples in the wiki]: https://github.com/hrs/fuzz/wiki
35
+
29
36
  I'm a fan of the excellent [RubyTapas screencasts][], and I'd like a script to
30
37
  let me interactively search through their titles to pick one to play. Here's a
31
38
  way I could do that:
@@ -92,8 +99,17 @@ Fuzz::Selector.new(
92
99
 
93
100
  ### Choosing a different picker
94
101
 
95
- Fuzz ships with support for `rofi` and `dmenu`. The `Fuzz::Selector` constructor
96
- takes an optional `picker:` argument to pick a picker.
102
+ Fuzz ships with support for numerous fuzzy-matching tools, which it calls
103
+ "pickers." The `Fuzz::Selector` constructor takes an optional `picker:` argument
104
+ to pick a picker.
105
+
106
+ | Executable | Creating an instance |
107
+ |------------|----------------------------------|
108
+ | `dmenu` | `Fuzz::DmenuPicker.new` |
109
+ | `peco` | `Fuzz::PecoPicker.new` |
110
+ | `pick` | `Fuzz::PickPicker.new` |
111
+ | `rofi` | `Fuzz::RofiPicker.new` (default) |
112
+ | `selecta` | `Fuzz::SelectaPicker.new` |
97
113
 
98
114
  For example, to use `dmenu` as your picker:
99
115
 
@@ -104,27 +120,9 @@ Fuzz::Selector.new(
104
120
  )
105
121
  ```
106
122
 
107
- Or to search in a terminal with the `pick` tool:
108
-
109
- ```ruby
110
-
111
- Fuzz::Selector.new(
112
- some_objects,
113
- picker: Fuzz::PickPicker.new,
114
- )
115
- ```
116
-
117
- The `rofi` picker is the default, but you can also explicitly specify it:
118
-
119
- ```ruby
120
- Fuzz::Selector.new(
121
- some_objects,
122
- picker: Fuzz::RofiPicker.new,
123
- )
124
- ```
125
-
126
- If your chosen picker can't be found (perhaps it's not installed, or not in your
127
- `$PATH`), `Fuzz::Selector#pick` will raise a `Fuzz::MissingExecutableError`.
123
+ If the executable associated with your chosen picker can't be found (perhaps
124
+ it's not installed, or not in your `$PATH`), `Fuzz::Selector#pick` will raise a
125
+ `Fuzz::MissingExecutableError`.
128
126
 
129
127
  ### Extending `fuzz` with new pickers
130
128
 
@@ -0,0 +1,9 @@
1
+ module Fuzz
2
+ class PecoPicker
3
+ def pick(keys)
4
+ Fuzz::Executable.new("peco").error_if_missing
5
+
6
+ `echo "#{ keys.join("\n") }" | peco`.strip
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ module Fuzz
2
+ class SelectaPicker
3
+ def pick(keys)
4
+ Fuzz::Executable.new("selecta").error_if_missing
5
+
6
+ `echo "#{ keys.join("\n") }" | selecta`.strip
7
+ end
8
+ end
9
+ end
@@ -1,3 +1,3 @@
1
1
  module Fuzz
2
- VERSION = "0.1.2".freeze
2
+ VERSION = "0.2.0".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fuzz
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Harry Schwartz
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-03-03 00:00:00.000000000 Z
11
+ date: 2018-03-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -91,8 +91,10 @@ files:
91
91
  - lib/fuzz/entry.rb
92
92
  - lib/fuzz/executable.rb
93
93
  - lib/fuzz/null_cache.rb
94
+ - lib/fuzz/peco_picker.rb
94
95
  - lib/fuzz/pick_picker.rb
95
96
  - lib/fuzz/rofi_picker.rb
97
+ - lib/fuzz/selecta_picker.rb
96
98
  - lib/fuzz/selector.rb
97
99
  - lib/fuzz/version.rb
98
100
  homepage: https://github.com/hrs/fuzz