djinni 2.2.3 → 2.2.4
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 +4 -4
- data/lib/djinni.rb +23 -16
- 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: 65fbf5d61e83c40690ef71ba3ac5e50a765bed3484538c259bb552be8510873b
|
4
|
+
data.tar.gz: 41b1874ab97cf60ef517676c0900ddd1b829b83888b54905128b2b9b07c9a30b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 86f50f88bfc700809dcbb9ef428a4ec54dfdfabd886d51c78408cb1ab4d841ec4d22e6c4d0542680e7e05d616ecaece0b8cb1cfddd266eecb2559c593c8aa7ce
|
7
|
+
data.tar.gz: 5c2b77fdfd136f203f89f1b68b573cec8d5e49a29bf1a48854641ae237d3fccb234bc26ab4891fd64381ebfb39347333b263eaed095412f5339fe46588fafb91
|
data/lib/djinni.rb
CHANGED
@@ -57,21 +57,23 @@ class Djinni
|
|
57
57
|
end
|
58
58
|
|
59
59
|
max = completions.keys.max_by(&:length).length
|
60
|
+
nlfill = ""
|
61
|
+
nlfill = " " * (max + space) if ((max + space) > 0)
|
60
62
|
width = @width - (max + space) - 2
|
61
63
|
|
62
64
|
puts
|
63
65
|
completions.each do |item, desc|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
lines = desc.scan(
|
69
|
-
/\S.{0,#{width}}\S(?=\s|$)|\S+/
|
70
|
-
)
|
66
|
+
desc ||= ""
|
67
|
+
fill = ""
|
68
|
+
if ((max + space - item.length) > 0)
|
69
|
+
fill = " " * (max + space - item.length)
|
71
70
|
end
|
71
|
+
lines = desc.scan(
|
72
|
+
/\S.{0,#{width}}\S(?=\s|$)|\S+/
|
73
|
+
)
|
72
74
|
|
73
75
|
if (lines.empty?)
|
74
|
-
puts
|
76
|
+
puts item
|
75
77
|
else
|
76
78
|
start = lines.delete_at(0)
|
77
79
|
puts "#{item}#{fill}#{start}"
|
@@ -81,10 +83,9 @@ class Djinni
|
|
81
83
|
end
|
82
84
|
end
|
83
85
|
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
)
|
86
|
+
longest = longest_common_substring(completions.keys)
|
87
|
+
return input if (longest.empty?)
|
88
|
+
return input.gsub(/#{replace}$/, longest)
|
88
89
|
else
|
89
90
|
wishes = @wishes.select do |aliaz, w|
|
90
91
|
aliaz.start_with?(input)
|
@@ -97,20 +98,24 @@ class Djinni
|
|
97
98
|
end
|
98
99
|
|
99
100
|
max = wishes.keys.max_by(&:length).length
|
101
|
+
nlfill = ""
|
102
|
+
nlfill = " " * (max + space) if ((max + space) > 0)
|
100
103
|
width = @width - (max + space) - 2
|
101
104
|
|
102
105
|
puts
|
103
106
|
wishes.sort do |a, b|
|
104
107
|
a.first.downcase <=> b.first.downcase
|
105
108
|
end.each do |aliaz, w|
|
106
|
-
fill = "
|
109
|
+
fill = ""
|
110
|
+
if ((max + space - aliaz.length) > 0)
|
111
|
+
fill = " " * (max + space - aliaz.length)
|
112
|
+
end
|
107
113
|
lines = w.description.scan(
|
108
114
|
/\S.{0,#{width}}\S(?=\s|$)|\S+/
|
109
115
|
)
|
110
|
-
nlfill = " " * (max + space)
|
111
116
|
|
112
117
|
if (lines.empty?)
|
113
|
-
puts
|
118
|
+
puts aliaz
|
114
119
|
else
|
115
120
|
start = lines.delete_at(0)
|
116
121
|
puts "#{aliaz}#{fill}#{start}"
|
@@ -228,6 +233,7 @@ class Djinni
|
|
228
233
|
|
229
234
|
def longest_common_substring(array)
|
230
235
|
compare = array.min_by(&:length)
|
236
|
+
compare ||= ""
|
231
237
|
loop do
|
232
238
|
break if (compare.empty?)
|
233
239
|
all = array.all? do |item|
|
@@ -248,7 +254,8 @@ class Djinni
|
|
248
254
|
buff = ""
|
249
255
|
loop do
|
250
256
|
djinni_prompt = djinni_env["djinni_prompt"]
|
251
|
-
blank_line = "
|
257
|
+
blank_line = ""
|
258
|
+
blank_line = " " * @width if (@width > 0)
|
252
259
|
|
253
260
|
# Handle long lines that get wrapped
|
254
261
|
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.4
|
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-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|