djinni 1.3.3 → 1.3.4
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 +13 -3
- data/lib/djinni/error/unknown_wish_error.rb +0 -2
- data/lib/djinni/wish/help.rb +0 -2
- data/lib/djinni/wish/history.rb +0 -2
- data/lib/djinni/wish/quit.rb +0 -2
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 91e0e374025777f899f2842312e3330505070933
|
4
|
+
data.tar.gz: 01b5498b5360fd208d5f6ccd64d0dc4741904704
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d34084799f17961d09785517aa0f6311ae8d17e1216cdf566c9bb17ab22408fdd90c75aa172c71df98b94cc1140658fcb99ad8d084fb4fdaf9a2109495331584
|
7
|
+
data.tar.gz: 4a2cbea7d9b71be603d7d073531477f9c4e2bf608238e045e1176736b5e6fcb339a911c372c9687aeed578d85b1045a447026c5dffa35050c6305fb5700afd3c
|
data/lib/djinni.rb
CHANGED
@@ -30,6 +30,7 @@ class Djinni
|
|
30
30
|
wish = @wishes[name]
|
31
31
|
complete = ""
|
32
32
|
begin
|
33
|
+
djinni_env["djinni_input"] = input
|
33
34
|
complete = wish.tab_complete(args, djinni_env)
|
34
35
|
rescue SystemExit => e
|
35
36
|
raise e
|
@@ -57,6 +58,7 @@ class Djinni
|
|
57
58
|
@wishes.sort.map do |aliaz, wish|
|
58
59
|
if (aliaz == name)
|
59
60
|
begin
|
61
|
+
djinni_env["djinni_input"] = input
|
60
62
|
wish.execute(args, djinni_env)
|
61
63
|
rescue SystemExit => e
|
62
64
|
raise e
|
@@ -142,14 +144,16 @@ class Djinni
|
|
142
144
|
@interactive = true
|
143
145
|
|
144
146
|
djinni_env["djinni_prompt"] = djinni_prompt
|
147
|
+
prev_len = 0
|
145
148
|
buff = ""
|
146
149
|
loop do
|
147
150
|
djinni_prompt = djinni_env["djinni_prompt"]
|
148
151
|
blank_line = Array.new(@width, " ").join
|
149
|
-
fill_len = @width - djinni_prompt.length - buff.length + 1
|
150
152
|
|
151
|
-
# Handle long
|
152
|
-
|
153
|
+
# Handle long lines that get wrapped
|
154
|
+
buff_len = remove_colors(djinni_prompt).length + prev_len
|
155
|
+
lines = buff_len / @width
|
156
|
+
lines -= 1 if ((buff_len % @width) == 0)
|
153
157
|
lines.times do
|
154
158
|
print "\r#{blank_line}"
|
155
159
|
print "\e[F"
|
@@ -170,6 +174,7 @@ class Djinni
|
|
170
174
|
end
|
171
175
|
end
|
172
176
|
system("stty -raw echo")
|
177
|
+
prev_len = remove_colors(buff).length
|
173
178
|
buff = grant_wish(buff + input, djinni_env)
|
174
179
|
|
175
180
|
if (buff.nil?)
|
@@ -184,6 +189,11 @@ class Djinni
|
|
184
189
|
end
|
185
190
|
end
|
186
191
|
|
192
|
+
def remove_colors(str)
|
193
|
+
str.unpack("C*").pack("U*").gsub(/\e\[([0-9;]*m|K)/, "")
|
194
|
+
end
|
195
|
+
private :remove_colors
|
196
|
+
|
187
197
|
def store_history(input)
|
188
198
|
# Only keep newest wish if repeat
|
189
199
|
# @history.delete(input)
|
data/lib/djinni/wish/help.rb
CHANGED
data/lib/djinni/wish/history.rb
CHANGED
data/lib/djinni/wish/quit.rb
CHANGED
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: 1.3.
|
4
|
+
version: 1.3.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: 2016-03-
|
11
|
+
date: 2016-03-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|
@@ -59,7 +59,7 @@ dependencies:
|
|
59
59
|
version: '0.1'
|
60
60
|
- - ">="
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
version: 0.1.
|
62
|
+
version: 0.1.2
|
63
63
|
type: :runtime
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -69,7 +69,7 @@ dependencies:
|
|
69
69
|
version: '0.1'
|
70
70
|
- - ">="
|
71
71
|
- !ruby/object:Gem::Version
|
72
|
-
version: 0.1.
|
72
|
+
version: 0.1.2
|
73
73
|
- !ruby/object:Gem::Dependency
|
74
74
|
name: ruby-terminfo
|
75
75
|
requirement: !ruby/object:Gem::Requirement
|