djinni 2.1.4 → 2.2.0
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 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 66736812763e4cf4aadf25e3f8042963243ef8505519bf818c79f043fa07794d
|
4
|
+
data.tar.gz: fd78fe60b747299b7406e99295b8b532b31205027552508d516eebc190f62e7b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e92e4bafec00ef0f5dd3d4ac8018a5e3fc32b6804844e132ada460df369eac2cc28611785ba54ba3d130662527d6d338a0f5d2b0cce091f43d34ef738666db3
|
7
|
+
data.tar.gz: 21bd6987550f8fe399b3a52ff7fe505175ed7c15f75440dbfdd99fe9e0c4c6f5aff03b6107b521291d70f0690ed650b5e0c76e8abb0d939461f2dc8949fab5c5
|
data/lib/djinni.rb
CHANGED
@@ -2,6 +2,8 @@ require "fagin"
|
|
2
2
|
require "io/console"
|
3
3
|
|
4
4
|
class Djinni
|
5
|
+
attr_accessor :fallback
|
6
|
+
|
5
7
|
def grant_wish(input, djinni_env = {})
|
6
8
|
return "" if (input.nil? || input.empty?)
|
7
9
|
|
@@ -184,12 +186,13 @@ class Djinni
|
|
184
186
|
end
|
185
187
|
|
186
188
|
def initialize(interactive = false)
|
187
|
-
@
|
188
|
-
@history = Array.new
|
189
|
+
@fallback = nil
|
189
190
|
@hist_index = nil
|
191
|
+
@history = Array.new
|
190
192
|
@interactive = interactive
|
191
193
|
@loaded_from = Array.new
|
192
194
|
@width = %x(tput cols).to_i
|
195
|
+
@wishes = Hash.new
|
193
196
|
|
194
197
|
Signal.trap(
|
195
198
|
"SIGWINCH",
|
@@ -264,8 +267,16 @@ class Djinni
|
|
264
267
|
end
|
265
268
|
system("stty -raw echo")
|
266
269
|
prev_len = remove_colors(buff).length
|
270
|
+
save = buff
|
267
271
|
buff = grant_wish(buff + input, djinni_env)
|
268
272
|
|
273
|
+
if (buff.nil? && !@fallback.nil? && !@fallback.empty?)
|
274
|
+
puts "\e[2A"
|
275
|
+
buff = grant_wish(
|
276
|
+
@fallback + " " + save + input, djinni_env
|
277
|
+
)
|
278
|
+
end
|
279
|
+
|
269
280
|
if (buff.nil?)
|
270
281
|
puts "Command not found!"
|
271
282
|
buff = ""
|
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.
|
4
|
+
version: 2.2.0
|
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-03-
|
11
|
+
date: 2018-03-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|
@@ -106,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
106
106
|
version: '0'
|
107
107
|
requirements: []
|
108
108
|
rubyforge_project:
|
109
|
-
rubygems_version: 2.7.
|
109
|
+
rubygems_version: 2.7.6
|
110
110
|
signing_key:
|
111
111
|
specification_version: 4
|
112
112
|
summary: A Ruby command handler
|