djinni 1.3.4 → 1.3.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 91e0e374025777f899f2842312e3330505070933
4
- data.tar.gz: 01b5498b5360fd208d5f6ccd64d0dc4741904704
3
+ metadata.gz: 3d6bdde61547d555da94f76c9d3bdb07673cb4e2
4
+ data.tar.gz: 5c911b3278fd04e20803e01f1bcdb9bfbd7809b9
5
5
  SHA512:
6
- metadata.gz: d34084799f17961d09785517aa0f6311ae8d17e1216cdf566c9bb17ab22408fdd90c75aa172c71df98b94cc1140658fcb99ad8d084fb4fdaf9a2109495331584
7
- data.tar.gz: 4a2cbea7d9b71be603d7d073531477f9c4e2bf608238e045e1176736b5e6fcb339a911c372c9687aeed578d85b1045a447026c5dffa35050c6305fb5700afd3c
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 "\e[A" # Up arrow
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 "\e[B" # Down arrow
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 "\e[C" # Right arrow
98
+ when /\e[\[O]C/ # Right arrow
99
99
  # TODO maybe implement right arrow
100
100
  return input[0..-2]
101
- when "\e[D" # Left arrow
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
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-19 00:00:00.000000000 Z
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