djinni 0.1.9 → 0.1.10
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 +11 -11
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec712ec140052ac46cadf1536e6d01677ad2f3b6
|
4
|
+
data.tar.gz: 0871df60e4464dfa7fd1aa4f4da1a3177d241807
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 133735ba86e75da94280b638a09dcee2e425a296e5060900d094acbebdccd298a9066b5a8a6b8eb9a810f75ee567bd301b12420d9ae4eaa97fd15a4aae4ade57
|
7
|
+
data.tar.gz: 4f38d9654bb91c7a44d2a22a9e76298f3067a7db55c334ce47d7aff78fc7f1600a4c5feec9d77d8b2f00388a82a715c4ea0cbee9043542344b045f0ee017260e
|
data/lib/djinni.rb
CHANGED
@@ -151,18 +151,18 @@ class Djinni
|
|
151
151
|
@loaded_from.push(dir)
|
152
152
|
end
|
153
153
|
|
154
|
-
def prompt(djinni_env = {},
|
154
|
+
def prompt(djinni_env = {}, djinni_prompt = "$ ")
|
155
155
|
@interactive = true
|
156
156
|
|
157
|
-
djinni_env["
|
158
|
-
|
157
|
+
djinni_env["djinni_prompt"] = djinni_prompt
|
158
|
+
buff = ""
|
159
159
|
loop do
|
160
|
-
|
160
|
+
djinni_prompt = djinni_env["djinni_prompt"]
|
161
161
|
blank_line = Array.new(@width, " ").join
|
162
|
-
fill_len = @width -
|
162
|
+
fill_len = @width - djinni_prompt.length - buff.length + 1
|
163
163
|
|
164
164
|
# Handle long line-wrapped prompts
|
165
|
-
lines = (
|
165
|
+
lines = (djinni_prompt.length + buff.length) / @width
|
166
166
|
lines.times do
|
167
167
|
print "\r#{blank_line}"
|
168
168
|
print "\e[F"
|
@@ -170,18 +170,18 @@ class Djinni
|
|
170
170
|
|
171
171
|
# Redisplay prompt
|
172
172
|
print "\r#{blank_line}"
|
173
|
-
print "\r#{
|
173
|
+
print "\r#{djinni_prompt}#{buff}"
|
174
174
|
|
175
175
|
# Process input
|
176
|
-
|
176
|
+
buff = grant_wish(buff + STDIN.getch, djinni_env)
|
177
177
|
|
178
|
-
if (
|
178
|
+
if (buff.nil?)
|
179
179
|
puts "Wish not found!"
|
180
|
-
|
180
|
+
buff = ""
|
181
181
|
end
|
182
182
|
|
183
183
|
# Exit on ^D
|
184
|
-
if (
|
184
|
+
if (buff == "\x04")
|
185
185
|
return
|
186
186
|
end
|
187
187
|
end
|