djinni 1.3.4 → 1.3.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/djinni/wish/clear.rb +22 -0
- data/lib/djinni.rb +4 -4
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3d6bdde61547d555da94f76c9d3bdb07673cb4e2
|
4
|
+
data.tar.gz: 5c911b3278fd04e20803e01f1bcdb9bfbd7809b9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c684bdacedecc922a6853c6624c8bd47ccf8da7daf3af9e76048ae8917f22129cfb3d15d5efe530d16f3a054e8b529eaf02fbb745413314650962a770282075c
|
7
|
+
data.tar.gz: b1709e68b1205931c8c254af7fe6bede4614062c832188ac322808a5592293016e91220e08d76e17c947e382d1716cc4d816303dbcfa3c55dead8faa16842c62
|
@@ -0,0 +1,22 @@
|
|
1
|
+
class Djinni::Wish::Clear < Djinni::Wish
|
2
|
+
def aliases
|
3
|
+
return [ "clear", "cls" ]
|
4
|
+
end
|
5
|
+
|
6
|
+
def description
|
7
|
+
return "Clear the screen"
|
8
|
+
end
|
9
|
+
|
10
|
+
def execute(args, djinni_env = {})
|
11
|
+
if (args.nil? || args.empty?)
|
12
|
+
system("clear")
|
13
|
+
else
|
14
|
+
usage
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def usage
|
19
|
+
puts aliases.join(", ")
|
20
|
+
puts "\t#{description}."
|
21
|
+
end
|
22
|
+
end
|
data/lib/djinni.rb
CHANGED
@@ -80,13 +80,13 @@ class Djinni
|
|
80
80
|
t.kill if (t)
|
81
81
|
|
82
82
|
case code
|
83
|
-
when
|
83
|
+
when /\e[\[O]A/ # Up arrow
|
84
84
|
return "" if (@history.empty?)
|
85
85
|
@hist_index = @history.size if (@hist_index.nil?)
|
86
86
|
@hist_index = 1 if (@hist_index == 0)
|
87
87
|
@hist_index -= 1
|
88
88
|
return @history[@hist_index]
|
89
|
-
when
|
89
|
+
when /\e[\[O]B/ # Down arrow
|
90
90
|
@hist_index = @history.size if (@hist_index.nil?)
|
91
91
|
@hist_index += 1
|
92
92
|
if (@hist_index < @history.size)
|
@@ -95,10 +95,10 @@ class Djinni
|
|
95
95
|
@hist_index = @history.size
|
96
96
|
return ""
|
97
97
|
end
|
98
|
-
when
|
98
|
+
when /\e[\[O]C/ # Right arrow
|
99
99
|
# TODO maybe implement right arrow
|
100
100
|
return input[0..-2]
|
101
|
-
when
|
101
|
+
when /\e[\[O]D/ # Left arrow
|
102
102
|
# TODO maybe implement left arrow
|
103
103
|
return input[0..-2]
|
104
104
|
else
|
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.5
|
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-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|
@@ -102,6 +102,7 @@ files:
|
|
102
102
|
- lib/djinni/error.rb
|
103
103
|
- lib/djinni/error/unknown_wish_error.rb
|
104
104
|
- lib/djinni/wish.rb
|
105
|
+
- lib/djinni/wish/clear.rb
|
105
106
|
- lib/djinni/wish/help.rb
|
106
107
|
- lib/djinni/wish/history.rb
|
107
108
|
- lib/djinni/wish/quit.rb
|