peco_selector 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/peco_selector.rb +9 -4
- data/lib/peco_selector/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 377f5266c991dde84cbaf9437a5ff8ddf085ae20
|
4
|
+
data.tar.gz: 119f8c601ebea5e434d00dc42f5a461e25fe3f5d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fbb85be1124ab30d0c4c5ac24627df3576ae62753bf2c072f7f6c6a62eb89db5b8c752884851965e9c30f4bdbf5cc3b9f4a85d21b2b73973fef556969698df10
|
7
|
+
data.tar.gz: eda13b07a001d535565ae7e813ba7bacb9217499882be0b1c7913935ec385b316a584f7a6584a8485e50f1c3943642602ef37163361c44946a371901c6efab3e
|
data/lib/peco_selector.rb
CHANGED
@@ -13,7 +13,9 @@ module PecoSelector
|
|
13
13
|
|
14
14
|
def select_from(candidates, options = {})
|
15
15
|
prompt = options[:prompt] || "QUERY>"
|
16
|
-
|
16
|
+
|
17
|
+
stdout_str = nil
|
18
|
+
stderr_str = nil
|
17
19
|
|
18
20
|
Open3.popen3("#{PECO_BIN} --null --prompt #{Shellwords.escape(prompt)}") do |stdin, stdout, stderr, wait_thr|
|
19
21
|
candidates.each do |display, value|
|
@@ -21,15 +23,18 @@ module PecoSelector
|
|
21
23
|
end
|
22
24
|
stdin.close
|
23
25
|
|
24
|
-
|
26
|
+
stdout_str = stdout.read
|
27
|
+
stderr_str = stderr.read
|
25
28
|
|
26
29
|
unless wait_thr.value.exitstatus == 0
|
27
|
-
$stdout.print
|
28
|
-
$stderr.print
|
30
|
+
$stdout.print stdout_str
|
31
|
+
$stderr.print stderr_str
|
29
32
|
abort
|
30
33
|
end
|
31
34
|
end
|
32
35
|
|
36
|
+
object_ids = stdout_str.strip.split("\n").map(&:to_i)
|
37
|
+
|
33
38
|
candidates.map do |_, value|
|
34
39
|
value
|
35
40
|
end.select do |value|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: peco_selector
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryota Arai
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -73,7 +73,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
73
73
|
version: '0'
|
74
74
|
requirements: []
|
75
75
|
rubyforge_project:
|
76
|
-
rubygems_version: 2.
|
76
|
+
rubygems_version: 2.4.5
|
77
77
|
signing_key:
|
78
78
|
specification_version: 4
|
79
79
|
summary: Select objects with peco
|