djinni 2.2.2 → 2.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/djinni.rb +15 -10
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1fcd7ceeb81b894886dcca48088eea5012cef7a750f3df0ffe39beb1baf012aa
|
4
|
+
data.tar.gz: d3d8ea9414e871314a41d1d2fd3ee07ee6d5433d188eac3caf55b699a44f6bd8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b6f740be301aebd532a4799db0ff56e2fc1527e7d77c1b02310153ac45a5b1585dabbfb574d9e095861bfe8cc1c7a8a7fb47a69a231f6a0e008f1fc7d2b49bef
|
7
|
+
data.tar.gz: 2078235c6392ea62d2b2011a6689f3960dcff358977b60d848c1224dcdafa22a88a344e38d6382a695e733b529130c051e0d59534cc3495009e1bb89565ed2aa
|
data/lib/djinni.rb
CHANGED
@@ -10,6 +10,7 @@ class Djinni
|
|
10
10
|
djinni_env["djinni"] = self
|
11
11
|
djinni_env["djinni_history"] = @history
|
12
12
|
djinni_env["djinni_wishes"] = @wishes
|
13
|
+
space = 4
|
13
14
|
|
14
15
|
case input[-1]
|
15
16
|
when "\x03" # ^C
|
@@ -55,15 +56,17 @@ class Djinni
|
|
55
56
|
)
|
56
57
|
end
|
57
58
|
|
58
|
-
puts
|
59
59
|
max = completions.keys.max_by(&:length).length
|
60
|
+
width = @width - (max + space) - 2
|
61
|
+
|
62
|
+
puts
|
60
63
|
completions.each do |item, desc|
|
61
|
-
fill =
|
62
|
-
nlfill = Array.new(max + 4, " ").join
|
64
|
+
fill = " " * (max + space - item.length)
|
63
65
|
lines = ""
|
66
|
+
nlfill = " " * (max + space)
|
64
67
|
if (desc)
|
65
68
|
lines = desc.scan(
|
66
|
-
/\S.{0,#{
|
69
|
+
/\S.{0,#{width}}\S(?=\s|$)|\S+/
|
67
70
|
)
|
68
71
|
end
|
69
72
|
|
@@ -93,16 +96,18 @@ class Djinni
|
|
93
96
|
return "#{wishes.first.first} "
|
94
97
|
end
|
95
98
|
|
96
|
-
puts
|
97
99
|
max = wishes.keys.max_by(&:length).length
|
100
|
+
width = @width - (max + space) - 2
|
101
|
+
|
102
|
+
puts
|
98
103
|
wishes.sort do |a, b|
|
99
104
|
a.first.downcase <=> b.first.downcase
|
100
105
|
end.each do |aliaz, w|
|
101
|
-
fill =
|
102
|
-
nlfill = Array.new(max + 4, " ").join
|
106
|
+
fill = " " * (max + space - aliaz.length)
|
103
107
|
lines = w.description.scan(
|
104
|
-
/\S.{0,#{
|
108
|
+
/\S.{0,#{width}}\S(?=\s|$)|\S+/
|
105
109
|
)
|
110
|
+
nlfill = " " * (max + space)
|
106
111
|
|
107
112
|
if (lines.empty?)
|
108
113
|
puts "#{aliaz}"
|
@@ -198,7 +203,7 @@ class Djinni
|
|
198
203
|
@wishes = Hash.new
|
199
204
|
|
200
205
|
Signal.trap(
|
201
|
-
"
|
206
|
+
"WINCH",
|
202
207
|
proc do
|
203
208
|
@width = %x(tput cols).to_i
|
204
209
|
end
|
@@ -243,7 +248,7 @@ class Djinni
|
|
243
248
|
buff = ""
|
244
249
|
loop do
|
245
250
|
djinni_prompt = djinni_env["djinni_prompt"]
|
246
|
-
blank_line =
|
251
|
+
blank_line = " " * @width
|
247
252
|
|
248
253
|
# Handle long lines that get wrapped
|
249
254
|
buff_len = remove_colors(djinni_prompt).length + prev_len
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: djinni
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miles Whittaker
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-06-
|
11
|
+
date: 2018-06-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|