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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b6abf1e0ece31884864db6ae1d4658dc52af7f62
4
- data.tar.gz: 83b73f32e95cba72104b6f9b0b175a50915f9094
3
+ metadata.gz: 377f5266c991dde84cbaf9437a5ff8ddf085ae20
4
+ data.tar.gz: 119f8c601ebea5e434d00dc42f5a461e25fe3f5d
5
5
  SHA512:
6
- metadata.gz: 67f597b0fe05ed053114b47fcbcf6ae89bd7d9610052f963847101d89e97beace5bc899ceab9da3d552ae7ec47d4350e908cb5f90334061cd43384f89499154c
7
- data.tar.gz: 27663f0974dc9079275f3f0fb799945410b76b39ec1106a3ef4c0491e278f882df6726143864c22f656f028989e300af7b97691c4b48d161914b2ef24ae749b0
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
- object_ids = nil
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
- object_ids = stdout.read.strip.split("\n").map(&:to_i)
26
+ stdout_str = stdout.read
27
+ stderr_str = stderr.read
25
28
 
26
29
  unless wait_thr.value.exitstatus == 0
27
- $stdout.print stdout.read
28
- $stderr.print stderr.read
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|
@@ -1,3 +1,3 @@
1
1
  module PecoSelector
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
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.2
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-10 00:00:00.000000000 Z
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.2.2
76
+ rubygems_version: 2.4.5
77
77
  signing_key:
78
78
  specification_version: 4
79
79
  summary: Select objects with peco