djinni 2.0.0 → 2.0.1
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/history.rb +2 -4
- data/lib/djinni.rb +6 -4
- metadata +2 -3
- data/lib/string.rb +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9e662c2bb1aff1c1aac6c4a445e14a37084347cd
|
4
|
+
data.tar.gz: 8403c6d023b124f228c48d853dbf58e398a9876e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 762e97138d90e73b69249a24cdbe4daca17e7aaa76facaecaffef7d49f8ca0edc39c637b924ca6feaebb697598c2dd602b1e7aadc0526926c3640076b1f43563
|
7
|
+
data.tar.gz: 1ea3b7384cc98aac18c8539149615e8a448d82c6ad32bcd9d14a840caa9844e5b3e1255c0ec49741b131b4e5963061f9356992df6b1b56b4e19cf1b1f1bbf5f7
|
data/lib/djinni/wish/history.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
require "string"
|
2
|
-
|
3
1
|
class Djinni::Wish::History < Djinni::Wish
|
4
2
|
def aliases
|
5
3
|
return ["hist", "history"]
|
@@ -49,7 +47,7 @@ class Djinni::Wish::History < Djinni::Wish
|
|
49
47
|
|
50
48
|
def tab_complete(input, djinni_env = {})
|
51
49
|
history = djinni_env["djinni_history"]
|
52
|
-
input, last = input.
|
50
|
+
input, found, last = input.rpartition(" ")
|
53
51
|
included = input.split(" ")
|
54
52
|
|
55
53
|
completions = Hash.new
|
@@ -62,7 +60,7 @@ class Djinni::Wish::History < Djinni::Wish
|
|
62
60
|
!included.include?(item)
|
63
61
|
end
|
64
62
|
|
65
|
-
if (
|
63
|
+
if (!last.empty?)
|
66
64
|
completions.keep_if do |item, desc|
|
67
65
|
item.downcase.start_with?(last.downcase)
|
68
66
|
end
|
data/lib/djinni.rb
CHANGED
@@ -59,7 +59,9 @@ class Djinni
|
|
59
59
|
completions.each do |item, desc|
|
60
60
|
fill = Array.new(max + 4 - item.length, " ").join
|
61
61
|
nlfill = Array.new(max + 4, " ").join
|
62
|
-
lines = desc.
|
62
|
+
lines = desc.scan(
|
63
|
+
/\S.{0,#{80 - (max + 4)}}\S(?=\s|$)|\S+/
|
64
|
+
)
|
63
65
|
|
64
66
|
if (lines.empty?)
|
65
67
|
puts "#{item}"
|
@@ -94,9 +96,9 @@ class Djinni
|
|
94
96
|
end.each do |aliaz, w|
|
95
97
|
fill = Array.new(max + 4 - aliaz.length, " ").join
|
96
98
|
nlfill = Array.new(max + 4, " ").join
|
97
|
-
lines = w.description.
|
98
|
-
80 - (max + 4)
|
99
|
-
)
|
99
|
+
lines = w.description.scan(
|
100
|
+
/\S.{0,#{80 - (max + 4)}}\S(?=\s|$)|\S+/
|
101
|
+
)
|
100
102
|
|
101
103
|
if (lines.empty?)
|
102
104
|
puts "#{aliaz}"
|
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.0.
|
4
|
+
version: 2.0.1
|
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-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|
@@ -106,7 +106,6 @@ files:
|
|
106
106
|
- lib/djinni/wish/help.rb
|
107
107
|
- lib/djinni/wish/history.rb
|
108
108
|
- lib/djinni/wish/quit.rb
|
109
|
-
- lib/string.rb
|
110
109
|
homepage: https://mjwhitta.github.io/djinni
|
111
110
|
licenses:
|
112
111
|
- GPL-3.0
|
data/lib/string.rb
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
# Modify String class to allow for rsplit and word wrap
|
2
|
-
class String
|
3
|
-
def rsplit(pattern)
|
4
|
-
ret = rpartition(pattern)
|
5
|
-
ret.delete_at(1)
|
6
|
-
return ret
|
7
|
-
end
|
8
|
-
|
9
|
-
def word_wrap(width = 80)
|
10
|
-
return scan(/\S.{0,#{width}}\S(?=\s|$)|\S+/).join("\n")
|
11
|
-
end
|
12
|
-
end
|